Skip to content

Instantly share code, notes, and snippets.

@tan3
Created April 8, 2014 07:36
Show Gist options
  • Save tan3/10099780 to your computer and use it in GitHub Desktop.
Save tan3/10099780 to your computer and use it in GitHub Desktop.
htaccess: block comment spam by denying access to no-referrer requests
# block comment spam by denying access to no-referrer requests
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .myform\.php* [OR]
RewriteCond %{REQUEST_URI} .myotherform\.php*
RewriteCond %{HTTP_REFERER} !.*mysite.de.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule ^(.*)$ $1 [R=403,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment