Jump to content

Block MediaWiki spam

From FVue

Problem

Spammers are trying to get through to my site statistics. They're pouring http links in every hole they can find. How can I prevent this spam?

Solution 1: Block specific http referrers

Add this to Apache .htaccess:

RewriteCond %{HTTP_REFERER} ^.*(tvsetmp3|freeliveporno).*$ [NC]
RewriteRule .* - [F]

This will send an http status code 403 (Forbidden) to requests with HTTP_REFERER containing `tvsetmp3' or `freeliveporno'.

Add this to Apache .htaccess:

RewriteRule http: - [F]

This will send an http status code 403 (Forbidden) to requests with an additional http: added to the url path, e.g.:

http://www.fvue.nl/wiki/Article_http://link.to.spam.site

Add this to Apache .htaccess:

RewriteCond %{QUERY_STRING} http(:|%3A)
RewriteRule .* - [F]

This will send an http status code 403 (Forbidden) to requests with http links added to the query string, e.g.:

http://www.fvue.nl/w/index.php?title=Article&from=http%3A%2F%2Flink.to.spam.site

See also

Apache HTTP Server Version 1.3 - Module mod_rewrite URL Rewriting Engine
The Apache manual for mod_rewrite
HTTP:1.1: Status Code Definitions
List of HTTP status codes and their meanings

Journal

WordPress Support - Trouble blocking a nasty referrer
Same forum question with answer

20080427

Installed the Bad Behavior extension.