Anna
Anna

Reputation: 126

Wordpress admin page .htaccess exceptions

I have a website made with wordpress (it's a multilingual site) and I'm modifying the .htaccess file in order to make some redirections. My page now is for example: https://example.es

And I'd like to redirect everything to this page (even if you type example.es/en or www.example.es/en or http://www.example.es/es ... all the variants)

My .htaccess now looks like this:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.es$ [NC]
RewriteCond %{REQUEST_URI} jh73820h.htm$ [NC]
RewriteRule .* - [L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://example.es/$1 [R=301,L,QSA]

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

# END WordPress

It works but when I try to go to my admin page in Wordpress (https://example.es/wp-admin/) I'm being redirect to https://example.es/es/wp-admin/ or https://example.es/en/wp-admin/.

Does anybody know how can I make an exception for this page? I don't want to be redirect when the site is wp-admin, it should be like this: https://example.es/wp-admin/

Upvotes: 1

Views: 1601

Answers (1)

cweitat
cweitat

Reputation: 1247

Try adding RewriteCond %{REQUEST_URI} !wp-admin before RewriteEngine on.

If it doesn't works follow the link below; put RewriteCond %{REQUEST_URI} !wp-adminbefore # BEGIN Wordpress

Look here: Redirect Visitors to new url but exclude images and admin

Upvotes: 3

Related Questions