301 Redirect not working in HTACCESS file
We have a list of 301 redirects in the .htaccess file. They are simple rules written one on each line as so:
PHP Code:
These URLs are resolving like this and returning a 404 Page Not Found error: Code:
https://domain.com/new-url.htm?url=old-url&last=&rest=&ext= They seem to be redirecting properly and the final URL would be fine if the page wasn't 404'd. It looks like there is a rule in x-carts .htaccess file that appends a string to the URL if a certain file or directory does not exist from the URL. PHP Code:
What is the purpose of this rewrite? More importantly, how can I make the 301 Redirect rules work properly? Should I be trying a different route? Please help as this is urgent. Any insight is much appreciated. Thanks in advance. |
Re: 301 Redirect not working in HTACCESS file
These are for proper functioning of clean URLs.
* http://kb.x-cart.com/display/XDD/Setting+up+seo-friendly+URLs |
Re: 301 Redirect not working in HTACCESS file
Igor,
Thanks for your reply. I understand that's what the rules are for, but that really doesn't help answer my question. How can I get the "Redirect 301" rules to work properly? Do you have any insight? What is the proper way add redirect rules to x-cart? Why are these pages not resolving when there is the query string at the end? |
Re: 301 Redirect not working in HTACCESS file
Try something like that
Code:
RewriteRule ^all\-products\/category(.*) "https\:\/\/www\.yoursite\.com\/all\-products\/category" [R=301,L] |
Re: 301 Redirect not working in HTACCESS file
Igor, this is perfect. I converted all of the redirects to that format and everything appears to be working great. Thanks for the suggestion.
|
Re: 301 Redirect not working in HTACCESS file
Quote:
Glad I could help :) |
Re: 301 Redirect not working in HTACCESS file
Please help,
having the same issue as the above poster. on all of my x-cart 4.x installs the standard Redirect 301 always has worked well. but in 5.2 it appends this strange stuff that makes the redirect fail. I have attempted to use: RewriteRule ^all\-products\/category(.*) "https\:\/\/www\.yoursite\.com\/all\-products\/category" [R=301,L] but is does not work for me. I am trying to re-point several directories for example: www.naturalbathbody.com/bath/bath-and-shower/ which now is: www.naturalbathbody.com/bath-and-shower/ the above code snipped may work well with .html pages, but I have tried multiple ways to format changing categories and it just will not work. can someone please post an example instead of the code snippet? that would really help. thanks in advance, Marc W. |
Re: 301 Redirect not working in HTACCESS file
Could you please post here the exact rewrite rule that isn't working?
|
Re: 301 Redirect not working in HTACCESS file
Quote:
This is a very normal 301 redirect: .htaccess last line: Redirect 301 /Natural-Shaving-Gel.html https://www.naturalbathbody.com/apollon-shaving-gel.html The redirect is picked up and if you go to page: http://www.naturalbathbody.com/Natural-Shaving-Gel.html the it jumps to this page: https://www.naturalbathbody.com/apollon-shaving-gel.html?url=Natural-Shaving-Gel&last=&rest=&ext=.html but of course this page does not exist and the extra garbage that is appended causes a 404 error. please help ... maybe you can show me an example of how that 301 code above has to be structured in X-cart 5.2.15... thank you in advance Marc |
Re: 301 Redirect not working in HTACCESS file
I would try with the dynamic url instead
Redirect 301 /Natural-Shaving-Gel.html https://www.naturalbathbody.com/cart.php?target=product&productid=XX example for a product page |
All times are GMT -8. The time now is 02:56 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.