Forum Moderators: phranque
The old stucture was:
PHP files - *.php(not blocked by robots.txt)
HTML files - replicated store with static HTML catalog in /catalog/ (for better search engine positions)
/catalog/p"productid"-"product-name".html
Now with the new version I use MOD (XC SEO) that uses MOD_REWRITE to rewrite PHP files to HTML. It puts everything to the root (I want it that way)
For instance:
/product.php?productid=11111
becomes
/canon-a640-camera
Now I would like to redirect OLD CATALOG html urls from OLD STORE to new urls MODED with MODREWRITE.
OLD URLS:
/catalog/p"productid"-"product-name".html
NEW URLS
/"product-name"-p"productid" (no ending)
Product name and productid are the same in both cases!
Due to I already have some rewrite rules in htaccess setup by XC SEO mod, should I create a map with 301 redirects, or should I rewrite those old URLS too?
I have about 7500 products.
I know I could retain the "old" product name with productid first and redirect only folder, but
my test show that products rank better with "new" style.
Thank you for your help!
P.S.
1 thing more... I could't find what [QSA,L] means. Usually i see here 301 as 301 redirect?
my curent .htaccess product rules##### XC SEO Lite
# Rewrite SEO product URL's
RewriteRule ^([^/]*/)?[^/]+-print-c-([0-9]+)-p-([0-9]+)-pr-([0-9]+)$$1product.php?printable=Y&productid=$4&cat=$2&page=$3[QSA,L]
RewriteRule ^([^/]*/)?[^/]+-c-([0-9]+)-p-([0-9]+)-pr-([0-9]+)$$1product.php?productid=$4&cat=$2&page=$3[QSA,L]
RewriteRule ^([^/]*/)?[^/]+-print-pr-([0-9]+)$$1product.php?printable=Y&productid=$2[QSA,L]
RewriteRule ^([^/]*/)?[^/]+-pr-([0-9]+)$$1product.php?productid=$2[QSA,L]
The QSA and L flags are documented in the RewriteRule [httpd.apache.org] section of the mod_rewrite documentation. Please don't attempt to use mod_rewrite without reading that document! It appears that you may be able to use the simpler RedirectMatch [httpd.apache.org] directive from mod_alias if mod_rewrite is too daunting for your taste.
Jim
RedirectMatch 301 ^/catalog/p([0-9]{1,7})-([^.]+)\.html$ http://www.example.com/$2-pr-$1
Jim