Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- 301'ing over 50 thousand pages


g1smd - 10:47 am on Mar 9, 2011 (gmt 0)


You could name almost any big company and their site does it.

You don't pass any data between your two rewrites.

You set up a redirect (using RewriteRule and [R=301,L]) so that when an old format URL is requested, the user is told to make a new request for the new format URL, for example (not the right rule for your site, just a quick example):

RewriteRule ^([^/]+)/([^_]+)_([^/]+)/([^/]+)/([^/]+)/([^.]+)$ http://www.example.com/$6/$2-$5 [R=301,L]

When the user returns moments later and requests the new URL, the Rewrite (using RewriteRule and [L]) connects that request to the PHP script (with the data separated out into parameters) to be fulfilled.

RewriteRule ^(0-9+)/([^-]+)-(.*) /index.php?id=$1&manu=$2&prod=$3 [L]

At this point, the old internal rewrite is redundant. Old format URLs are no longer internally rewritten to the script, they are redirected to the new URL.

I prefer product ID at the beginning. I don't add category information to URLs. This creates duplicate content problems when a product is in multiple categories. However, a product can easily link out to the category pages of all the categories it can be found in.

That is,
www.example.com/153773/this-great-acme-widget links out to www.example.com/widgets, www.example.com/acme, www.example.com/under-50-quid and www.example.com/sale-items where the single canonical product URL without category is listed in the links from those categories back to the product page itself.


Thread source:: http://www.webmasterworld.com/apache/4278367.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com