Tom Rudge
Tom Rudge

Reputation: 3272

deny and allow ip access .htaccess

Seen lots of info regarding this but can't figure out this scenario. I want to deny all uk ips but allow my own uk ip.

I have a big list of deny ip addresses which work fine and deny access, but I want to be able to access the site for obvious reasons!

Basically I'm creating a site for Irish consumer base and the owner wants to exclude the UK from accessing the site. But I need to access it still.

Upvotes: 1

Views: 8342

Answers (1)

Abhishek Gurjar
Abhishek Gurjar

Reputation: 7476

In your .htaccess file put this rule in same manner and write your ip's which are whitelisted in allow from your ip

<Directory "/">
   order deny,allow
   deny from all
   allow from 127.0.0.1
   allow from 127.0.0.2
</Directory>

Using Require

<RequireAll>
    Require all granted
    Require not ip 10.252.46.165
</RequireAll>

https://httpd.apache.org/docs/2.4/howto/access.html

Upvotes: 1

Related Questions