1

I'd like to restrict the allowed IPs to UK and a second country, say Brazil or whatever other one.

I did find an answer, but the link to the tutorials are not working.

Any help will be appreciated.

Cheers

Rakesh patanga
  • 832
  • 9
  • 25
Sergio
  • 608
  • 12
  • 35

1 Answers1

1

The below .htaccess can helpyou.

<Limit GET HEAD POST>
order deny,allow
deny from all
allow from 11.305.12.0/29
allow from ....
</LIMIT>

Just give ipaddess ranges of UK & Second country in the allow from part

Source:

Updated answer

My best idea would be.To handle it in the application level rather than webserver level.you can easily get country name using the ip-address which can get from webrequst If its UK or second country then you can let him see you main page or else you can redirect to a page that says the access protection available to the countris

Community
  • 1
  • 1
Rakesh patanga
  • 832
  • 9
  • 25
  • Thanks Naga R. I did see the source. I uinderstand it, but I don´t get how to know what ranges I must use for a particular country. – Sergio Feb 14 '15 at 11:17
  • Thanks Naga. I'll do some experiments with the info. – Sergio Feb 14 '15 at 11:32
  • Here is a webservice aka API that does it...http://www.webservicex.net/geoipservice.asmx?op=GetGeoIP – Rakesh patanga Feb 14 '15 at 11:34
  • @Sergio - Any improvements so far ? – Rakesh patanga Feb 21 '15 at 13:05
  • I have had horrible problems with my internet provider. Right now the connection is fallin down nine times per hour, so I need to fix that. Cheers – Sergio Feb 28 '15 at 05:17
  • @Sergio - I'd really appreciate if you share the solution so that we can look for some other ways and fine tune it. – Rakesh patanga Mar 01 '15 at 10:41
  • 1
    Sorry, Naga. It was a bad year start. Technical problems, first, and serious health problems came to ruin the last months. I did check it as the right answer. Thanks and cheers. – Sergio Apr 01 '15 at 00:16