Big Spender Posted December 9, 2014 Share Posted December 9, 2014 In the latest CC5, I have a variety of categories which need removing, I want to squirt their juice at some other categories using 301 redirects. I have the standard .htaccess included in CC5, but adding for example: RewriteEngine On Redirect 301 /index.php?_a=category&cat_id=4 http://www.domain.co.uk/new-category-name.html OR RewriteEngine On Redirect 301 /category-name.html http://www.domain.co.uk/new-category-name.html To redirect the old URLs just results in the old category being loaded (as I don't want to delete them yet) I am guessing the initial CubeCart SEO URLs are interfering but .htaccess isn't really my strong point. Maybe I need to rename their SEO URLs to something else first, then try the 301 I have added...? Any pointers? Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 9, 2014 Share Posted December 9, 2014 "Maybe I need to rename their SEO URLs to something else first." Having the web server tell the browser to try this different URL: Redirect 301 /category-name.html http://www.domain.co.uk/new-category-name.html when the old URL was used, should work fine. The important point to verify is that CubeCart has recorded new-category-name as as an seo_path in the CubeCart_seo_urls database table. Quote Link to comment Share on other sites More sharing options...
Big Spender Posted December 9, 2014 Author Share Posted December 9, 2014 Okay, so the new category is in the SEO urls table so that is okay. I made an error inputting the old category name into the htaccess originally which I have fixed, now when I try it redirects to the correct URL but the category shown is still the old category and the URL has the following appended: /new-category.html?seo_path=old-category Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 9, 2014 Share Posted December 9, 2014 The querystring gets added by rewrite rules at the bottom of the htaccess file. If that happens, then I would have to guess the Redirect 301 from to command is currently located after the rewrite command, or for some reason, the web server wants to run through all the commands before sending the 301 headers back to the browser. What I believe needs to happen is for the web server to see the Redirect 301 and send the headers immediately. Quote Link to comment Share on other sites More sharing options...
havenswift-hosting Posted December 9, 2014 Share Posted December 9, 2014 Hi Please show us a full example of a 301 ReDirect command you have added - it is likely that the syntax isn't 100% correct Thanks Ian Quote Link to comment Share on other sites More sharing options...
Big Spender Posted December 9, 2014 Author Share Posted December 9, 2014 The answer to this is to add your redirect in this format: RewriteRule ^shop/oldcat.html$ http://www.domain.co.uk/newcat.html[L,R=301] Directly under here: <IfModule mod_rewrite.c> RewriteEngine On "The Redirect directive is part of mod_alias, while the rest of your htaccess file is using mod_rewrite. This means your redirect is getting applied along with the rule which matches (.*).html, so 2 things are getting applied to the same request. In this case, it's best to just stick with mod_rewrite." Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.