I'm struggling to fix an issue with 301 redirects and .htaccess
. I have moved a site from an old domain to a new domain. And I have successfully managed to do this with a 301 redirect. Like so:
Redirect 301 / https://newdomain.com
On the old site child category URLs are like this:
olddomain.com/product-category/parent-cat1/parent-cat2/child-cat
or
olddomain.com/product-category/parent-cat1/child-cat
or
olddomain.com/product-category/child-cat
Whereas on the new site they are:
newdomain.com/product-category/child-cat
Unfortunately, this is resulting in 404s from the redirects. Is there any way to remove the parent categories (which can vary by name and amount of them) from the URL?
/parent-cat/parent-cat/
" - Are these two instances ofparent-cat
the same? Or is that really/parent-cat1/parent-cat2/
? You say the number ofparent-cat
can vary... from 1 to how many? What characters are part of theproduct-category
andchild-cat
? – Bandwagon