Forum Moderators: phranque

Message Too Old, No Replies

Blocking access to countries

.htaccess file blocking

         

benevolent001

4:00 pm on Dec 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello,
It has been long since i have been trying to use .htaccess file to block certian asian and african countries but i dont know what to do
i searched some of posts here and in one of post it was written to download GeoIP.dat file from website and use it.
i am just confused its so difficult to do with no instructions can some one of you please help me out in this.

I want to redirect people from those countries to some other page or just show then access denied page

How can i do this.

Thanks in advance

sublime1

6:41 pm on Dec 19, 2004 (gmt 0)

10+ Year Member



Any solution that relies on IPs will be hopelessly flawed. Changes in registration rules in the last few years make it less likely that you can accurately impute an origin from the IP. And if you're trying to get rid of the spammers and bots, they are more likely to have an IP that's "incorrect" than real users.

If instead you are trying to help people get to a more appropriate page for their language, I suppose the next best bet is to look at the http Accept-Language header and rewrite requests accordingly.

If you have language or locale specific pages, I think the best solution is to offer a link to these pages from your home or even all pages on your site so that the choice is the user's. I prefer this solution to that favored by some companies which is to force users to select their location before they get any further.

If you still want to use a list, typically these are implemented as a map -- a set of name-value pairs, such as an IP address or range and a country code. See Apache's RewriteMap directive which provides a way to look in a file like this, look up the name and return the value. You can then use this value to make a RewriteRule that directs the user to the desired place.

benevolent001

7:18 pm on Dec 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How do some people are doing in there website that when ever some one from outside of there permitted county visit there website they show

Access denied Page

wilderness

7:34 pm on Dec 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Any solution that relies on IPs will be hopelessly flawed.

Most solutions in life and computers are flawed and NONE prove 100$ effective.

At best we hinder the majority.

Don

wilderness

7:36 pm on Dec 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



benevolent,
what is your country of origin and what reigons are you considering denying?

Do your website (s) sell products which are universal and might your sales be influenced by denying regional visitors?

Don