Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 使用htaccess防止评论垃圾邮件_.htaccess_Mod Rewrite - Fatal编程技术网

.htaccess 使用htaccess防止评论垃圾邮件

.htaccess 使用htaccess防止评论垃圾邮件,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我正试图修改我的htaccess以防止垃圾邮件发送者的实例,并在搜索引擎日志中找到了一条提示,上面说要将此添加到我的文件中: # Protect from spam bots <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_METHOD} POST RewriteCond %{REQUEST_URI} .wp-comments-post\.php* RewriteCond %{HTTP_REFERER}

我正试图修改我的htaccess以防止垃圾邮件发送者的实例,并在搜索引擎日志中找到了一条提示,上面说要将此添加到我的文件中:

# Protect from spam bots
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.yourwebsite.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
</IfModule>
#防止垃圾邮件机器人
重新启动发动机
重写cond%{REQUEST_METHOD}POST
RewriteCond%{REQUEST_URI}.wp comments post\.php*
重写cond%{HTTP_REFERER}!。yourwebsite.com.*[或]
RewriteCond%{HTTP_USER_AGENT}^$
重写规则(.*)^http://%{REMOTE\u ADDR}/$[R=301,L]

我的当前文件具有以下代码。。。如何将两者合并?或者我甚至不应该添加额外的东西?我很感激你的想法

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress

事实上,所有的垃圾桶都可以绕过这一点,而不会出现任何问题。你有没有试过像Akismet这样的垃圾邮件处理系统?是的,我已经安装了,还有另外两个。我引用的文章建议将三个插件安装在一起——Akisment、AVH First Defense Anti-Spambot插件和Growmap Anti-Spambot插件。还建议在htaccess中添加一个附加层,以阻止一些垃圾邮件机器人。我承认这听起来有很多,但作者声称没有一条垃圾评论通过他的防御墙进入他的博客。而且,我的网站速度和钱包都没有成本,所以我的问题是,为什么不呢?