Forum Moderators: phranque
I need help creating a 301 permanent redirect rule that would behave as follows:
www.site.com/index.php?main_page=product_info&cpath=1&products_id=5
would redirect to:
www.site.com/index.php?main_page=product_info&products_id=5
However, it's not as easy as stripping out the cpath parameter. The cpath parameter should be stripped out if and only if the products_id parameter is present. For instance
www.site.com/index.php?main_page=product_info&cpath=1
would not redirect anywhere
Any help would be greatly appreciated.
RewriteCond %{QUERY_STRING} ^main_page=product_info&cpath=(.+)&products_id=(.+)$ [NC]
RewriteRule ^index\.php http://www.example.com/index.php?main_page=product_info&products_id=%2 [R=301]
[edited by: RewriteEngine at 6:33 pm (utc) on Sep. 4, 2007]
[edited by: jdMorgan at 3:34 am (utc) on Sep. 5, 2007]
[edit reason] example.com [/edit]