Jump to content

Blocking all countries accept the USA


Chrisj

Recommended Posts

I have a php site and am getting some spam via my registration page although it has a CAPTCHA image.

 

Some suggested blocking certain countries who they believed were the most notorious spammers.

 

They directed me to this page:

 

http://www.asiteaboutnothing.net/c_block-countries.html

 

where the author suggests code like this:

 

SetEnvIf CF-IPCountry CN BuzzOff=1
SetEnvIf CF-IPCountry RU BuzzOff=1
SetEnvIf CF-IPCountry IN BuzzOff=1
Order allow,deny
Allow from all
Deny from env=BuzzOff

 

A commentor on that page said this;

 

"wondering how I might be able to do basically the opposite, which would be to set htaccess to only allow visitors from specific countries...would like to restrict it to only US visitors without listing every other country on the planet. My gut says this should work:

 

 

SetEnvIf CF-IPCountry US IsUSA=1
Order deny,allow
Deny from all
Allow from env=IsUSA

"

 

Has anyone had success with these types of approaches?

Do you think this code can block all but the USA. I'd be interested in targeting only usa visitors to my site.

 

Can you provide some insight or your opinion on this subject?

Do you have a better solution?

 

Thanks.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.