Forum Moderators: phranque
Basically I want to use MOD_REWRITE to dynamically 301 redirect any of the old HTML catalog links to their new Xcart 4.1.x equivalent.
PRODUCT REDIRECT
OLD = ./catalog/product_1234_Big_Red_Widget.html
NEW = ./catalog/Big-Red-Widget-p-1234.html
SINGLE PRODUCT REDIRECT
RewriteRule ^/catalog/product_1234_Big_Red_Widget\.html$ /catalog/Big-Red-Widget-p-1234.html [R=301,L]
CATEGORY REDIRECT
OLD = ./catalog/category_99_Widgets_page_1.html
NEW = ./catalog/Widgets-orderby0-p-1-c-99.html
SINGLE CATEGORY REDIRECT
RewriteRule ^/catalog/category_99_Widgets_page_1\.html$ /catalog/Widgets-orderby0-p-1-c-99.html [R=301,L]
Basically what I am looking for is a REGULAR EXPRESSION to use in the category redirect and the product redirect but I am lost when it comes to REGEX. Could anyone offer up some advice as to what each redirect statement should look like using a REGEX to address all instances of product redirects in a single statement and all instances of category redirects in a single statement.
RewriteRule ^/catalog/category_([0-9]+)_([^_]+)_page_([0-9]+)\.html$ http://example.com/catalog/$2-orderby0-p-$3-c-$1.html [R=301,L]
For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim