Revision: 16952
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 19, 2009 04:30 by roflman79
Initial Code
RewriteRule ^casual?$ product_list.php?cat=3 [L] RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteCond %{QUERY_STRING} ^(.*&)?cat=3(&.*)?$ [NC] RewriteRule ^product_list\.php$ /casual? [NC,R=301,L]
Initial URL
Initial Description
Great little bit of code for if you are rewriting URLs but then want the old GET URLs to rewrite to their rewritten URLs (phew). Good for telling Google where the new pages are with a 301 rather than getting both indexed. In this example, i had a page for casual menswear which was 'www.domain.com/product_list.php?cat=3' but i rewrote this URL to be 'www.domain.com/casual' only problem is that because they both still existed Google still had the '?cat=3' page indexed as the casual page, so this bit of code 301 redirects anyone wanting the '?cat=3' to the new '/casual' page.
Initial Title
mod_rewrite old URL to new URL
Initial Tags
apache
Initial Language
Apache