I’ve been struggling for days trying to find a way to allow certain redirects in my WP site without them showing on the address bar.
It should work like this: if the user types mydomain.com/abc
he is redirected to mydomain.com/xyz
but in his browser the address bar still displays mydomain.com/abc
Now that sounds simple enough but I can’t make it work for the life of me. I thought the canonical_redirect function in WP was causing some kind of conflict, so I disabled it, but it still won’t work.
I’ve tried this code in .htaccess (and several variants)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^en-uk(/.*)?$ /en$1 [L]
The redirect works fine, but the URL in the address bar changes to the new page, which is not what I want.
Any ideas?
Try this