Forum Moderators: phranque
If you'd like some background on a correct implementation, see the thread Changing Dynamic URLs to Static URLs [webmasterworld.com], in our Forum Library.
Jim
Thank you for you response. The old URL's were: www.example.com/show.php?mi=184 and we used a mod_rewrite to change the new urls to something like: http://www.example.com/shows/musicals/184/some-broadway-play-tickets.php
By using the following rewrite rule:
RewriteRule ^shows/(.*)/(.*)/(.*)\.php$ show.php?cname=$1&mi=$2&mname=$3 [L]
We would really like to have the old URL's 301 to the new ones but like I said it keeps looping, is there anyway around this?
[edited by: jdMorgan at 7:42 pm (utc) on Sep. 5, 2008]
[edit reason] Use example.com please. [/edit]
You changed the links on your pages to point to the new URLs, and then added mod_rewrite code to "connect" those URLs back to your script.
It is important to understand this, to avoid confusing the discussion.
Your original rule is very inefficient. You might want to use more-specific regex subpatterns like this to speed it up:
RewriteRule ^shows/([^/]+)/([^/]+)/([^.]+)\.php$ show.php?cname=$1&mi=$2&mname=$3 [L]
Jim
It used to be that show.php?cname=do&mi=re&mname=mi was the URL and the filename.
Now the URL is example.com/shows/do/re/mi.php and the filename is show.php?cname=do&mi=re&mname=mi, and your mod_rewrite rule takes care of the new URL-to-filename mapping.
It will take Google some time --guessing up to three months-- to figure out that you've changed the URLs and to pass the PR from the old URL to the new. However, you do need that third step to help it along, as described in the cited thread -- A 301 redirect from show.php?cname=do&mi=re&mname=mi to example.com/shows/do/re/mi.php for direct client requests only.
The code is in that thread.
Jim
Please click on the link I provided above and read the cited thread looking for the "third step," so that I do not have to repeat myself -- and possibly make a small error that will cost you more time.
We make much use of archival threads here, and for good reason... For one thing the code has been tried by many people and found to work properly, and for another, it saves needless repetition.
Take the rule shown there, modify it, and post back here if any specific propblems or questions.
Thanks,
Jim
Glad that helped...
Jim