Reputation: 710
I am trying to write an htaccess conditional redirect rule, but with no luck so far.
How can I use an htaccess redirect to redirect
http://www.domain.tld/en/oldpath/something/
http://www.domain.tld/en/oldpath/somethingelse/
to, respectively
http://www.domain.tld/en/newpath/something/
http://www.domain.tld/en/oldpath/somethingelse/
?
Is there a rule I can use to redirect "oldpath" to "newpath" whatever part of an url precedes or follows it?
Thank you for your help.
Upvotes: 1
Views: 58
Reputation: 784898
You can use:
RedirectMatch 302 ^(.*)/oldpath/(.*)$ $1/newpath/$2
Upvotes: 2