Conflict with WP and .htaccess mod_rewrite?

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

Read More

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?

Related posts

Leave a Reply

1 comment

  1. Try this

    <IfModule mod_rewrite.c>
    
        RewriteEngine On
        RewriteBase /xyz/
        RewriteRule ^index.php$ - [L]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /xyz/index.php [L]
    
    </IfModule>