I'm using modrewrite to rewrite some URLs, but when you request the old URL's, they still serve the same page as the new url... I want to redirect these pages using a 301 redirect See.. The urls used to be like /displayimage.php?cat=1 and now I am rewriting them to /thumbnails-1.html... the problem is, the /displayimage.php?cat=1 is already indexed in the search engines... so right now /displayimage.php?cat=1 and /thumbnails-1.html show the same page, I want /displayimage.php?cat=1 to 301 to /thumbnails-1.html everytime it is requested... how could i do this without effecting me rewritten URLS? here is current MODREWRITE
Look for the old URL in the REQUEST_URI e.g. RewriteCond %{REQUEST_URI} thumbnails.php?album=([a-z0-9]*)&cat=([a-z0-9]*) [NC] RewriteRule . thumbnails-%1-%2\.html
After going nuts with errors, I finally got the following code to work... besides the fact that below is a 301 redirect, how do the two differ? I found a rewrite for drupal and rewrote it for my application.. just want to make sure it works the same as they look significantly different (such as the_request vs request_ui and [A-Z]{3-9} and [a-z0-9]* I left out the category as I don't use the subcategories currently, so theres no need in rewriting rewritecond %{THE_REQUEST} ^[A-Z]{3,9}\ /thumbnails\.php\?album=([^&]+)\ HTTP/ rewriterule ^thumbnails\.php$ http://www.mysite.com/thumbnails-%1.html? [R=301,L] rewritecond %{THE_REQUEST} ^[A-Z]{3,9}\ /thumbnails\.php\?album=([^&]+)\&page=([^&]+)\ HTTP/ rewriterule ^thumbnails\.php$ http://www.mysite.com/thumbnails-%1-page-%2.html? [R=301,L] Thanks for the help.. never really messed with redirects in the past