I'm trying to protect the URL of my login admin page.

It's possible to allow only my ip to this page?

And if another IP tries to open the admin login page, there is an unauthorized permission.

I tried to add :

RewriteCond %{REMOTE_ADDR} !^

or :

RewriteCond %{REMOTE_ADDR} !^
RewriteRule ^(index.php/)?admin/ - [L,R=403]

but it doesn't work.

1 Answer 1


I think if you add the OR for index.php in your first example, it will work.

Here is an example of what is working for me:

#Restrict admin access
RewriteCond %{REQUEST_URI} ^/(index.php/)?ADMIN_PANEL_LOCATION/ [NC]
RewriteCond %{REMOTE_ADDR} !^99\.999\.999\.999

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.