Zen Follower
- Join Date:
- Oct 2007
- Posts:
- 415
- Plugin Contributions:
- 0
redirect obsolete links to a different page?
g1smd:
Please disregard the post immediately above.
You'll need this in the root .htaccess file:```
RewriteEngine On
RewriteCond %{QUERY_STRING} ^main_page=product_info&cPath=([0-9]+)&products_id=221$ [NC]
RewriteRule ^zencart/(index.php)?$ http://www.example.com/ [R=301,L]
>
> This redirects product ID 221 for all categories, for both www and non-www requests, and whether or not "index.php" is within the request.
>
> Change "zencart/" to your real folder name. Remove the "zencart/" part if the site is in the root folder. Note the trailing slash is also deleted.
>
> Final point. Never mix RewriteRule directives with Redirect or RedirectMatch directives within the same site. If you do, you can never be quite sure of the processing order. By mixing them up, you're using directives from two different Apache modules. Stick to just using RewriteRule for all directives.
Thanks for the info, however its still not redirecting my specific product page.
Here is what I do:
I want to redirect:
http://www.example.com/index.php?main_page=product_info&cPath=68&products_id=218
to <https://www.example.com>, so in my root htaccess I write:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^main_page=product_info&cPath=([0-9]+)&products_id=218$ [NC]
RewriteRule ^(index.php)?$ [url]http://www.example.com/[/url] [R=301,L]
When I then go to
http://www.example.com/index.php?main_page=product_info&cPath=68&products_id=218
the page keeps trying to load for about 3 - 4 minutes whereafter the pages finally loades with the product ID 218.
Any ideas what Im doing wrong?