Forum Moderators: phranque

Message Too Old, No Replies

Blocking Countries

Using htaccess to block potential site visitors

         

emforde

4:53 am on May 14, 2003 (gmt 0)



I have a site and I wish to block people from one particular country from viewing it. Is the best way to do this to use an htaccess file or is there a better way?

jdMorgan

5:22 am on May 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



emforde,

Welcome to WebmasterWorld [webmasterworld.com]!

.htaccess will do the job, but...

IP addresses are not assigned strictly by country, and you may have to cover many different ranges and sub-ranges if you wish to block only one country. This may entail several dozen lines of mod_access or mod_rewrite code.

There are alternatives, but some are more appropriate for one kind of problem than others.

Jim