I have a WordPress website. And I want to redirect a URL to another 3rd party domain. The issue is that destination domain cannot have trailing slash.
So I want to redirect http://www.domain.com/xyzxyzxyz
to http://3rd-party-domain.com/?something
It’s working fine for without trailing slash request urls
http://www.domain.com/xyzxyzxyz -> http://3rd-party-domain.com/?something
but when I try http://www.domain.com/xyzxyzxyz/
then it does not work because it adds trailing slash in destination URL too, which gives error.
I have tried these rewrite rules
Redirect 301 /xyzxyzxyz http://3rd-party-domain.com/?something
Redirect 301 /xyzxyzxyz/ http://3rd-party-domain.com/?something
Not working 🙁
Please let me know how to fix this.
Try
RedirectMatch
for its regex capabilities: