I am moving my WP ecommerce site to a new domain and I need to code a more advanced htaccess 301 redirect to pass on the SEO love. (I say htaccess but maybe there is a server side way that is better)
I have made sure, as much as possible, to keep the URL structure the same so for the products/posts, categories, tags and most pages everything after the olddomain.com/XXXXX
is the same.
However, I don't want to do a blanket redirect for everything because there are some parts of the site that will not match so I thought it better to break into into chunks/functions. (Maybe this is a bad strategy and I should just do do one blanket redirect and the trouble shoot page not found as it all goes live?)
- redirect function for products
- redirect function for categories
- redirect function for tags
- individual redirects for the rest
There are also three languages with sub folder /ca/
and /es/
- example.com/es/products
- assuming I can just copy the function for each language and appending the subfolder.
Examples:
oldomain.com/product/any-product-ABC
redirect to
newdomain.com/product/any-product-ABC
(Domain change) (folder same) (product added from previous)
Then same redirect for languages
oldomain.com/es/product/any-product-ABC
redirect to
newomain.com/es/product/any-product-ABC
How do I write the above redirects?