Block Countries in Apache
Assuming you have mod_geoip installed in apache we can block certain countries in 6 lines of code.
I had a client who was experiencing an inhumane amount of spam on their phpBB forums, which are notorious for bot attacks. Luckily this forum was geographically specific - so we can block all the countries we aren't interested in.
Here's the .htaccess code I put in the forums sub-directory
# START Block Countries
RewriteEngine On
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} !^(GB|US)$
RewriteRule ^(.*)$ http://www.some-page-outside-the-forum-directory$1 [L]
# END Block Countries
This code will allow only Great Britain and the United States into the forum directory, any other country will be redirected to a page describing why they aren't allowed instead of simply blocking them.
Related posts:
- mod_geoip Revisted including stopping spam in phpBB 2
I've recently moved a client's forum onto a new cPanel server, previously it was on... - Apache, JungleDisk and Port 80
I was tearing what little hair I have trying to solve a very strange bug... - SEO Friendly URLs for CubeCart in Windows
I have a client hosting CubeCart on a Windows server. Unfortunately the built in Apache... - Redirecting WordPress index.php to root
If you check the Page Rank of http://bloke.org against http://bloke.org/index.php, which are both, to a... - NTLM Authentication (Active Directory) on Apache (Linux)
Here is a quick guide to enabling NTLM authentication for Apache 2. I generally use...