suhel
suhel

Reputation: 753

Not able to restrict my admin panel through .htaccess

I want to restrict access to my magento admin pannel from specific ip only. I have put the following code in the .htaccess file as suggested in few forums. However, whenever insert the following code my whole site is showing forbidden access. Following is the code

RewriteCond %{REQUEST_URI} ^/(index.php/)?admin/ [NC]
RewriteCond %{REMOTE_ADDR} !^My_IP
RewriteRule ^(.*)$ http://%{HTTP_HOST}/ [R=302,L]

and

Order deny,allow
Deny from all
Allow from My IP

Kindly help!

Upvotes: 2

Views: 811

Answers (2)

Sebastian Walker
Sebastian Walker

Reputation: 187

Your IP will change over time, so after about 24 hours your Internet Provider will have updated your IP address and you will no longer have access to your Magento admin panel.

This is not a good idea.

Upvotes: 0

elixenide
elixenide

Reputation: 44851

Remove this block:

Order deny,allow
Deny from all
Allow from My IP

It forbids anyone from accessing your site unless they are using your IP. I'm assuming you replaced My IP with your IP address; if not, it will block you, too.

Upvotes: 1

Related Questions