Blocking Referers and IP adresses using mod_rewrite

Blocking a single referer: RewriteEngine on RewriteCond %{HTTP_REFERER} example\.net [NC] RewriteRule .* – [F] Block more than one referrer: RewriteEngine on RewriteCond %{HTTP_REFERER} example\.net [NC,OR] RewriteCond %{HTTP_REFERER} anotherexample\.net RewriteRule .* – [F] Using rewritemap: RewriteMap blacklist txt:/path/to/blacklist.txt RewriteCond %{HTTP_REFERER} ^(.*)$ RewriteCond ${blacklist:%1} ^denied$ [NC] RewriteRule (.*) – [F] Just create a text file blacklist.txt with the following […]

Blocking Hosts based on a mysql table in Postfix   Recently updated !

Using Postfix you sometimes would like to have your own list of hosts / IP addresses that you wish to block – to prevent them spamming your servers for example. As with Postfix you can use mysql as backend, you can use a mysql table to store this list in. First of all we add […]