category seo change

When I originally set up the seo addon I had categories set to

parent item name/item_name/page 2



so all my products seo show under different categories. Now I am upgrading to V3 I will have to 301 like below to all my new categories as I just want them to be



item name/page 2



the rule I can use in .htaccess is e.g


Redirect 301 /hi-visibility/hi-vis-vests/printed-hi-vis-vests.html # http://www.hivis.co.uk/printed-hi-vis-vests.html



but am asking if there is a solution that in 1 go may 301 redirect all second level categories instead of me manually doing each category



Thanks

John

You would need to specify a rule for each second level category, for example:



RedirectMatch 301 ^/hi-vis-vests/(.*)$ http://www.yoursite.com/$1
RedirectMatch 301 ^/hi-vis-jackets/(.*)$ http://www.yoursite.com/$1


This would effectively create the following 301 redirects:


/hi-visibility/hi-vis-vests/printed-hi-vis-vests.html > /hi-visibility/printed-hi-vis-vests.html

/hi-visibility/hi-vis-jackets/printed-hi-vis-jackets.html > /hi-visibility/printed-hi-vis-jackets.html


Replicate throughout your store for each second level category. In essence, this strips the matching word out of the URL, forming a 301 redirect in the process.

I did this a while back and looking at the .htaccess file I set up, this is what I did:


RewriteCond %{REQUEST_URI} /category-name/
RewriteRule ^.*$ http://www.domain.com/path/to/category-name.html [L,R=301]




I have a great category export tool that is posted here on the forum that is a huge help for this.



Basically install the exporter, then export your categories the way they are now. Then use Excel and make up your sheet. Then copy that into your .htaccess. Then change the SEO structure and upload your new .htaccess.



Kind of a pain in the neck, but not too bad.



Thanks,



Brandon

You're right Brandon, on looking at the default .htaccess for CS-Cart, the RewriteCond statement is used, therefore you shouldn't mix and match with RewriteCond/RewriteRule and RewriteMatch as they are two different modules and therefore are processed at different intervals which may cause unexpected behaviour. Stick with RewriteCond/RewriteRule.