instant 301 from old dynamic url to new static url
(will only work if you use the exact variables from the dynamic url)
Old dynamic url:
New Static url:
Cito:
#start .htaccess code
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^cat=([^&]+)&product_id=([^&]+)$
RewriteRule ^$ /catalog/%1-%2.html [R=301,L] |
Reg Expression notes:
[^&]+ mean find any character except the "&" since it is what seperates the variables in a string. you can back reference matches in a rewrite condition using ()'s just like your rewrite rules but to call them you have to use a % instead of a $.
Benefits:
1. You don't have to hand write 1,000's of 301 redirects
2. Spiders can easily pick up the 301 and pass the scores and index the new urls much faster than having to crawl the entire site over from scratch.
3. Users clicking old dynamic urls in the SERPS will not get a 404 error. They'll go straight to the new static urls