Forum Topic: redirecting shop

Forum: .htaccess Forum : Redirecting • Posted by Dogsized • Updated:

I just can't seem to figure out how to make this work. I've tried various redirects. I have wordpress and woo-commerce.

I want to change all the URLs in my "Shop by Brand" from:

http://dogsized.com/shop/petego-boby-bag/

to

http://dogsized.com/PetEgo/petego-boby-bag/

Same thing with "Shop by Category"

I want to change all the URLs in my shop (Shop by Category) from:

http://dogsized.com/shop/atom-pet-carrier/

to

http://dogsized.com/dog-bag-carrier/atom-pet-carrier/

I would GREATLY appreciate any suggestions / help.

Thanks,

Lynn

1 Reply to “redirecting shop”

Jeff Starr
Posted by Jeff Starr

The URLs that you are trying to match are basically the same (i.e., beginning with "shop"), so the trick is to differentiate between the two, which may not be possible depending on your configuration.

http://dogsized.com/shop/petego-boby-bag/
http://dogsized.com/shop/atom-pet-carrier/

For example, if all the redirects were headed to the same URL (say, /dog-bag-carrier/atom-pet-carrier/), then it would be easy to do something like this:

RedirectMatch 301 ^/shop/(.*) http://dogsized.com/dog-bag-carrier/$1

Without actually creating a list of posts, PHP may enable you to evaluate other factors, such as category or tag, to help distinguish between the two redirects.