Forum Moderators: phranque

Message Too Old, No Replies

htaccess rewrite

looking for a critique

         

gomblue

12:31 am on Oct 20, 2010 (gmt 0)

10+ Year Member



RewriteCond %{QUERY_STRING} Category_Code=GI&Product_Code=ARCHIPMILK&Screen=PROD
RewriteRule ^(.*)$ http://www.example.com/p/archipelago.html? [R=301,L]


Is this the best way to 301 a page like that? I am creating new urls for about 100 pages.

It appears to work, but I want to make sure search engines understand that the url has changed.

g1smd

6:50 am on Oct 20, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes, the 301 status tells them the old URL is replaced by the new. You have a redirect to the new URL.

If you have more than a few of these, a more workable approach is to set up a database with old and new URLs listed, and have a PHP script which sends the 301 status and URL. You then rewrite (rewrite, not redirect) these requests to the special script and the script sends the redirect. You then have just one line of code for this in .htaccess, and updating the URL mapping is simply a case of adding new URL pairs to the database.