Jump to content

Country IP Blocks


sparky

Recommended Posts

eeeeekkk... don't let my customers see it ;)

 

We had one guy with an .htaccess file that was almost 1MB in size and it pretty much crippled his site as he wanted to list all the IPs in the world that couldn't access his site, etc. What a nightmare.

 

Found it much easier to have him on a VPS and load up mod_geoip. Now he can just type in the name of the country he wants to show and it will do it.

 

edit .htaccess file

 

GeoIP ON

SetEnvIF GEOIP_COUNTRY_CODE CN BlockThese

SetEnvIF GEOIP_COUNTRY_CODE TR BlockThese

# Add more countries here

 

Deny from env=BlockThese

 

Maybe someone can use that one rather than IP ranges as the more lines you have in your .htaccess file the longer it takes to load the pages.

 

Don't forget, you MUST compile mod_geoip in Apache ;)

 

 

Deny from GEOIP_COUNTRY_CODE

Link to comment
Share on other sites

  • 2 weeks later...

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated