Looks like Magento redirects anything with index.php in the URL straight to the home page if you're using SEO friendly URLs. The issue is that we have an old website that has a ton of URLs indexed that look like this: /index.php?route=product/product&product_id=70
So 301 redirects in the htaccess file do not work and I also tried adding the URLs to Magento Admin's URL Rewrite Management with no luck. Is there any way to make this work?
Example, this is what I'm currently doing that doesn't work thanks to the index.php:
redirect 301 /index.php?route=product/product&product_id=70 http://www.bosu.com/bosu-sports-conditioning-football
You can't match against the query string in a Redirect
directive, you'll need to use either the %{QUERY_STRING}
or %{THE_REQUEST}
variables inside a rewrite condition. Note that Redirect
is part of mod_alias, which is separate from mod_rewrite, and both modules will get applied to the same request. So if you're using both, there's a good chance the directives could interfere with each other.
Try adding this before any rules related to magento:
RewriteCond %{THE_REQUEST} \?route=product/product&product_id=70($|&|\ )
RewriteRule ^index\.php$ http://www.bosu.com/bosu-sports-conditioning-football? [L,R=301]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.