Htaccess 文件设定技巧(一)防 spam

纯属扯蛋


         在谈这之前,我不得不抱怨 UEStudio 在编辑此类文件时的确很郁闷,保存下来的名名是 htaccess 文件,然而系统却显示两者同名同类文件却能共存同盘,给我的感觉是两者中有一者不是 htaccess 文件,我日,我得说是该换 zend 工具的时候了。


言归正转   

         以前 John Lucci 写了几篇关于防止 Spam 的具体方法,今天来介绍如何通过设置 htaccess 文件来达到防 Spam 的效果,对于评论尤其是那些没有 referrer 来源的链接。

         具体操作是将以下代码加入到 htaccess 文件中。

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

        顺便说下它的原理是:阻止垃圾评论机器人通过 wp-comments-post.php 来判断垃圾评论。简单!实用!

看过这篇文章的读者还看过:

2 Responses to “Htaccess 文件设定技巧(一)防 spam”

  1. Says:

    Very interesting site, but you must improve your template graphics.


  2. Says:

    Thank you for your idea,this themplate graphics isn’t good for talking about wordpress and i don’t know how to arrange the template .By the way,your site is very beautiful and substantial ,do you have some skill or technique about wordpress?thanks!


留下您的脚印