WordPress.org

Ready to get started?Download WordPress

Forums

Problem with spam comments and registrations (10 posts)

  1. B_Dark
    Member
    Posted 1 year ago #

    Hello, I've built a multisite and I have a problem with spam comments and spam registrations. How can I solve this problem?

  2. B_Dark
    Member
    Posted 1 year ago #

    For registration I followed the steps on darcynorman.net, and for the comments I followed the steps on http://www.seobloggerstips.com/2012/07/16/how-to-stop-spam-comments-count-without-using-wordpress-plugin/

    My multisite .htaccess is like that. Is everything ok now?

    SecFilterEngine Off
    SecFilterScanPOST Off
    php_value memory_limit 1024M
    #php_admin_flag safe_mode off
    
    # BEGIN ANTISPAMBLOG REGISTRATION
    
    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC]
    RewriteRule ^feed/?.*$ http://feeds.feedburner.com/mysite [L,NC,R=302]
    RewriteRule ^home?.*$ http://feeds.feedburner.com/mysite [L,NC,R=301]
    RewriteRule ^wp-content/uploads/(.*)$ http://mysite.com/files/$1 [L,R=301]
    RewriteRule ^wp-content/gallery/(.*)$ http://mysite.com/files/$1 [L,R=301]
    RewriteRule ^wp-content/uploads/jw-player-plugin-for-wordpress/player/player.swf$ http://mysite.com/files/jw-player-plugin-for-wordpress/player/player.swf$1 [L,R=301]
    RewriteCond %{REQUEST_METHOD} POST
    RewriteCond %{REQUEST_URI} .wp-signup.php*
    RewriteCond %{HTTP_REFERER} !.mysite.com. [OR]
    RewriteCond %{HTTP_USER_AGENT} ^$
    RewriteRule (.*) http://die-spammers.com/ [R=301,L]
    RewriteCond %{REQUEST_METHOD} POST
    RewriteCond %{REQUEST_URI} .wp-comments-post.php*
    RewriteCond %{HTTP_REFERER} !.*mysite.com.* [OR]
    RewriteCond %{HTTP_USER_AGENT} ^$
    RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
    
    # Prevent folder browsing
    Options All -Indexes
    
    <Files wp-config.php>
    order allow,deny
    deny from all
    </Files>
    
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php$ - [L]
    
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
    
    # BEGIN Watermark Hotlinked Images
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://mysite.com  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.gr  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.facebook.com  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.twitter.com  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.com.tr  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.co.uk  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.bing.com  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.pl  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.com.sa  [NC]
    RewriteCond %{HTTP_REFERER} !^http://images.search.yahoo.com  [NC]
    RewriteCond %{HTTP_REFERER} !^http://ixquick.com  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.hu  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.co.kr  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.nl  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.se  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.de  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.ca  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.it  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.es  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.com.cy  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.ru  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.com.br  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.yahoo.com  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.com  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.co.in  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.fr  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.co.ve  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.tt  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.cl  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.co.za  [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google.co.th  [NC]
    RewriteCond %{HTTP_REFERER} !^http://feeds.feedburner.com/mysite  [NC]
    RewriteRule ^(.*\.(png|gif|jpe?g))$ http://mysite.com/wp-content/plugins/watermark-hotlinked-images/watermark.php?img=$1 [L]
    </IfModule>
    
    # END Watermark Hotlinked Images
    
    #Begin gzip and deflate
    <IfModule mod_deflate.c>
     AddOutputFilterByType DEFLATE text/html text/css application/x-javascript text/plain text/xml image/x-icon
    </IfModule>
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/html M3600
    ExpiresByType text/css M3600
    ExpiresByType application/x-javascript M3600
    ExpiresByType image/bmp M3600
    ExpiresByType image/gif M3600
    ExpiresByType image/x-icon M3600
    ExpiresByType image/jpeg M3600
    </IfModule>
  3. Huh. No. But mostly because it's all jumbled up and not optimized.

    Rule 1: WordPress goes at the bottom
    Rule 2: Inline comment your sections
    Rule 3: Don't mix them together - everything should be grouped logically
    Rule 4: Regex is your friend :)

    Try this:

    # BASIC SECURITY
    
    SecFilterEngine Off
    SecFilterScanPOST Off
    php_value memory_limit 1024M
    #php_admin_flag safe_mode off
    
    # Prevent folder browsing
    Options All -Indexes
    
    <Files wp-config.php>
    order allow,deny
    deny from all
    </Files>
    
    # BEGIN feedburner and uploaded files adjustments.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC]
    RewriteRule ^feed/?.*$ http://feeds.feedburner.com/mysite [L,NC,R=302]
    RewriteRule ^home?.*$ http://feeds.feedburner.com/mysite [L,NC,R=301]
    RewriteRule ^wp-content/uploads/(.*)$ http://mysite.com/files/$1 [L,R=301]
    RewriteRule ^wp-content/gallery/(.*)$ http://mysite.com/files/$1 [L,R=301]
    RewriteRule ^wp-content/uploads/jw-player-plugin-for-wordpress/player/player.swf$ http://mysite.com/files/jw-player-plugin-for-wordpress/player/player.swf$1 [L,R=301]
    </IfModule>
    
    # BEGIN ANTISPAMBLOG REGISTRATION
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_METHOD} POST
    RewriteCond %{REQUEST_URI} .wp-signup.php*
    RewriteCond %{HTTP_REFERER} !.mysite.com. [OR]
    RewriteCond %{HTTP_USER_AGENT} ^$
    RewriteRule (.*) http://die-spammers.com/ [R=301,L]
    
    RewriteCond %{REQUEST_METHOD} POST
    RewriteCond %{REQUEST_URI} .wp-comments-post.php*
    RewriteCond %{HTTP_REFERER} !.*mysite.com.* [OR]
    RewriteCond %{HTTP_USER_AGENT} ^$
    RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
    </IfModule>
    
    # BEGIN Watermark Hotlinked Images
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?mysite.com  [NC]
    RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?google.\ [NC]
    RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?facebook.com [NC]
    RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?twitter.com [NC]
    RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?yahoo.\ [NC]
    RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?bing.\ [NC]
    RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?ixquick.com  [NC]
    RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?feeds.feedburner.com/mysite  [NC]
    RewriteRule ^(.*\.(png|gif|jpe?g))$ http://mysite.com/wp-content/plugins/watermark-hotlinked-images/watermark.php?img=$1 [L]
    </IfModule>
    
    # END Watermark Hotlinked Images
    
    #Begin gzip and deflate
    <IfModule mod_deflate.c>
     AddOutputFilterByType DEFLATE text/html text/css application/x-javascript text/plain text/xml image/x-icon
    </IfModule>
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/html M3600
    ExpiresByType text/css M3600
    ExpiresByType application/x-javascript M3600
    ExpiresByType image/bmp M3600
    ExpiresByType image/gif M3600
    ExpiresByType image/x-icon M3600
    ExpiresByType image/jpeg M3600
    </IfModule>
    
    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php$ - [L]
    
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
    #END WordPress
  4. B_Dark
    Member
    Posted 1 year ago #

    still have a lot of spam comments

  5. Did you setup Akismet or Cookies for Comments?

  6. B_Dark
    Member
    Posted 1 year ago #

    no only the .htaccess rules

  7. Then please setup Akismet and/or cookies for comments :)

  8. B_Dark
    Member
    Posted 1 year ago #

    btw what is the Regex?

  9. RegEx - Regular Expressions: http://www.regular-expressions.info/

Topic Closed

This topic has been closed to new replies.

About this Topic