Support » Fixing WordPress » HTACCESS wp-comments-post for multiple sites

  • Regarding suggested htaccess mods to combat comment spam:

    RewriteEngine On
    RewriteCond %{REQUEST_METHOD} POST
    RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
    RewriteCond %{HTTP_REFERER} !.*yourdomain.com.* [OR]
    RewriteCond %{HTTP_USER_AGENT} ^$
    RewriteRule (.*) http://%{REMOTE_ADDR}/$ [R=301,L]

    How do you change it if you have multiple domains?

    This doesn’t work:

    RewriteEngine On
    RewriteCond %{REQUEST_METHOD} POST
    RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
    RewriteCond %{HTTP_REFERER} !.*yourdomain1.com.* [OR]
    RewriteCond %{HTTP_REFERER} !.*yourdomain2.com.* [OR]
    RewriteCond %{HTTP_USER_AGENT} ^$
    RewriteRule (.*) http://%{REMOTE_ADDR}/$ [R=301,L]

    Thanks for the help!

  • The topic ‘HTACCESS wp-comments-post for multiple sites’ is closed to new replies.