WordPress.org

Ready to get started?Download WordPress

Forums

HTACCESS wp-comments-post for multiple sites (1 post)

  1. nfong
    Member
    Posted 5 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic