So I’m doing a site with around 4,000 products and urls are changing from there old site and don’t fancy making 301 rules for each one so I’ve done the following to move categories (examples below)
# Main Categories
RewriteRule ^(.*)home-page-categories/name-1\.html$ name-1/ [R=301,NC,L]
RewriteRule ^(.*)home-page-categories/name-2\.html$ name-2/ [R=301,NC,L]
RewriteRule ^(.*)home-page-categories/name-3\.html$ name-3/ [R=301,NC,L]
RewriteRule ^(.*)home-page-categories/name-4\.html$ name-4/ [R=301,NC,L]
So the above makes the home-page-categories/name-1.html into a single directory /name-1/ – great!
# Artist Categories from Root Categories
RewriteRule ^(.*)home-page-categories/name-1/(.*)\.html$ name-1/$2/ [R=301,L]
RewriteRule ^(.*)home-page-categories/name-2/(.*)\.html$ name-2/$2/ [R=301,L]
RewriteRule ^(.*)home-page-categories/name-3/(.*)\.html$ name-3/$2/ [R=301,L]
RewriteRule ^(.*)home-page-categories/name-4/(.*)\.html$ name-4/$2/ [R=301,L]
The over then grabs the secondary categories such as /home-page-categories/name-1/example.html and make it name-1/example/ – great!
However on the next level I need to carry the product name so it would be:
/home-page-categories/name-1/example/product.html and make it name-1/example/product.html but the rule above I think might conflict with that.
Any ideas on a rule that can handle this all?
To keep in line with your examples, a solution could be, for
name-1Depending on what you wish to achieve, you could replace all your rules with
Or with more specific rules