Jump to content


[Tutorial] Rewrite Internal Page URLs


2 replies to this topic

#1 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 10 September 2005 - 12:24 AM

Here is an example .htaccess file to show how you can change the URLs of your internal pages using mod_rewrite. Of course you need to have mod_rewrite active on your server in order for this to work. I just used this one on a site to make the internal page URLs look a little nicer. It is manual but it does the trick. This particular example only works for the internal pages (pid). As always, I make no warranty as to the effectiveness or safety of this example. But it worked for me. :thumbsup:


RewriteEngine On



#example

#RewriteRule ^gallery/(.*)/(.*) /index.php?ind=gallery&op=$1&ida=$2



# internal pages

RewriteRule ^rules /index.php?pid=1

RewriteRule ^judges /index.php?pid=2

RewriteRule ^photographers /index.php?pid=3

RewriteRule ^landowners /index.php?pid=4

RewriteRule ^digital_rules /index.php?pid=5

RewriteRule ^digital_participants /index.php?pid=6

RewriteRule ^sponsors /index.php?pid=7

RewriteRule ^kritters4kids /index.php?pid=8

RewriteRule ^books /index.php?pid=9

RewriteRule ^exhibit /index.php?pid=10

RewriteRule ^about_us /index.php?pid=11

RewriteRule ^patrons /index.php?pid=12

RewriteRule ^order /index.php?pid=13

RewriteRule ^contact_us /index.php?pid=14

RewriteRule ^2003_photographers /index.php?pid=15

RewriteRule ^2003_landowners /index.php?pid=16

RewriteRule ^archive /index.php?pid=17

What this does is change the URL of my page from mysite.com/index.php?pid=1 to mysite.com/rules

It's really nice and easy for the pages. Wish it was that easy for the rest of the portal. :)


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#2 UpadeshS

  • Members
  • 4 posts
  • Nepal

Posted 28 January 2010 - 01:34 PM

So should i make the rewrite rule for each page i create?

Anyways thanks for gr8 site.

#3 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 28 January 2010 - 02:34 PM

View PostUpadeshS, on Jan 28 2010, 02:34 PM, said:

So should i make the rewrite rule for each page i create?

Anyways thanks for gr8 site.
Yes. There is a MKPortal SEO module available somewhere that does this automatically but my post above shows how to do this manually. I use it on sites where there are only a few pages.


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users