0

I'm trying to block all IP'sbut my own but it doesn't work for me. I use the following code as answered in Deny all, allow only one IP through htaccess

order deny,allow
deny from all
allow from MyIP

But it lets other IP's access too. My IP is static and my site is hosted by a thirth party hosting service

Community
  • 1
  • 1
Paul Roefs
  • 368
  • 2
  • 3
  • 13

2 Answers2

0

I am not sure if your ip is static or not, Please try it like this,

<Files ~ ".*">
    order deny,allow
    deny from all
    allow from 127.0.0.1
</Files>

127.0.0.0 denotes your localhost.

Edit

Remove access rule and try it with mod_rewrite,

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REMOTE_ADDR} !^111\.111\.111\.111$ #your IP
    RewriteRule .* - [F]
</IfModule>
Abhishek Gurjar
  • 7,426
  • 10
  • 37
  • 45
0

If you did the following code:

order deny,allow deny from all allow from MyIP

and it also allowed other peoples ips then it has something to do with your host. Cause I ran the code on my site and it worked fine.

John Garza
  • 33
  • 4