apache - Redirect all deeplinks to new domain with slight change in all URL's -
i trying redirect pages of domaina domainb slight change in url structure.
for example:
i need redirect:
http://www.domaina.com/cars/fast-motors -> http://www.domainb.com/vehicles/fast-cars http://www.domaina.com/cars/slow-motors -> http://www.domainb.com/vehicles/slow-cars http://www.domaina.com/cars/red-motors -> http://www.domainb.com/vehicles/red-cars http://www.domaina.com/cars/pink-motors -> http://www.domainb.com/vehicles/pink-cars
i can manage redirtect allurls new domain this:
rewriteengine on rewriterule ^cars/(.*)$ http://www.domainb.com/vehicles/$1 [r=301,l]
but cant work out how change last word. theres thousands of these urls cant manually list of 301s. need redirect urls new domain switch /cars/
/vehicles/
, -motors
-cars
.
any appreciated.
thanks
you can use in .htaccess
file :
rewriteengine on rewriterule ^cars/(.*)-motors/? http://www.domainb.com/vehicles/$1-cars [r=302,l]
change [r=302]
[r=301]
when test work well.
Comments
Post a Comment