减少cookie传输_如何使用Cookie减少WordPress垃圾评论

减少cookie传输

A growing site comes with new challenges and one of them is comment spam. Thankfully, there are plenty of solutions to effectively fight comment spam. For example, using Akismet you can effectively reduce comment spam. You can also use CAPTCHA to block spamming bots. In this article, we will show you how to reduce WordPress comment spam with Cookies for Comments.

一个不断发展的网站面临着新的挑战,其中之一就是垃圾评论 。 值得庆幸的是,有许多解决方案可以有效地打击垃圾评论 。 例如, 使用Akismet,您可以有效地减少垃圾评论。 您还可以使用CAPTCHA阻止垃圾邮件机器人。 在本文中,我们将向您展示如何使用Cookies for Comments减少WordPress评论垃圾邮件。

First thing you need to do is install and activate the Cookies for Comments plugin. The plugin works out of the box and there are no settings for you to configure.

您需要做的第一件事是安装并激活Cookies for Comments插件。 该插件可以直接使用,没有可供您配置的设置。

评论Cookie如何工作? (How Cookies for Comments Work?)

Most of the comment spam is submitted by spam bots. These spam bots are basically software scripts that crawl the web looking for comment forms and then submit spam comments.

大多数评论垃圾邮件是由垃圾邮件机器人提交的。 这些垃圾邮件机器人基本上是一种软件脚本,可在网络上爬行以查找评论表单,然后提交垃圾邮件评论。

To spam thousands of websites, these programs don’t load images and stylesheets. The text on a page is enough for them to determine the presence of a comment form.

为了向成千上万的网站发送垃圾邮件,这些程序不会加载图像和样式表。 页面上的文本足以使他们确定评论表单的存在。

Cookies for comments plugin loads a stylesheet or an image when a page on your WordPress site is accessed. If the user’s browser downloads the stylesheet or image file, then the plugin sets a cookie in the user’s browser.

当您访问WordPress网站上的页面时,用于注释的Cookie插件将加载样式表或图像。 如果用户的浏览器下载了样式表或图像文件,则插件将在用户的浏览器中设置cookie。

The plugin checks for the cookie when any user tries to post a comment. If the cookie exists, then this means that the user is not a spam bot.

当任何用户尝试发表评论时,插件都会检查cookie。 如果该cookie存在,则意味着该用户不是垃圾邮件漫游器。

If the cookie does not exist, then the user is most likely a spam bot, and the comment they submit is marked as spam.

如果cookie不存在,则该用户很可能是垃圾邮件漫游器,并且他们提交的评论被标记为垃圾邮件。

如何从评论中完全阻止垃圾邮件机器人 (How To Completely Stop The Spam Bots From Commenting)

Cookies for Comments will successfully detect spammers, but it will let them post a comment. This comment goes into spam comments. With little more effort, you can stop the bots from posting a comment altogether.

评论用Cookie可以成功检测到垃圾邮件发送者,但可以使他们发布评论。 此评论将成为垃圾评论。 只需付出更多努力,您就可以完全阻止僵尸程序发表评论。

To do that, you will need to find out the cookie value. Right click anywhere on the your website, and then select View Page Source.

为此,您需要找出Cookie值。 右键单击网站上的任意位置,然后选择查看页面源

Opening page source view in Google Chrome

This will open a new tab in your browser showing the page’s HTML source. You need to scroll down to the bottom of the page until you find a line similar to this one:

这将在浏览器中打开一个新标签,显示页面HTML源。 您需要向下滚动到页面底部,直到找到与此相似的行:


<img alt='css.php' src="http://example.com/wp-content/plugins/cookies-for-comments/css.php?k=9692e3a737ecafe8fe6329490410ff50&amp;o=i&amp;t=201927728" width='1' height='1' />

The value after css.php?k= is the value of the cookie. Like in this example, it is 9692e3a737ecafe8fe6329490410ff50. You will need this value in the next step.

css.php?k=之后的值是cookie的值。 像此示例一样,它是9692e3a737ecafe8fe6329490410ff50 。 下一步将需要此值。

Now you need to connect to your website using an FTP client and edit the .htaccess file. Simply paste this code before anything else in your .htaccess file.

现在,您需要使用FTP客户端连接到您的网站并编辑.htaccess文件。 只需将此代码粘贴在.htaccess文件中的其他任何内容之前。


RewriteCond %{HTTP_COOKIE} !^.*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.*$
RewriteRule ^wp-comments-post.php - [F,L]

You need to replace XXX with the cookie value.

您需要将Cookie值替换为XXX。

That’s all. Your .htaccess file will now look for a cookie value and when it is not found, it will stop the user from commenting.

就这样。 您的.htaccess文件现在将查找cookie值,当找不到该cookie值时,它将阻止用户发表评论。

We hope this article helped you reduce WordPress comment spam on your site.

我们希望本文能帮助您减少网站上的WordPress评论垃圾邮件。

If you liked this article, then please subscribe to our YouTube Channel for more WordPress video tutorials. You can also find us on Twitter and Google+.

如果您喜欢这篇文章,请订阅我们的YouTube频道,以获取更多WordPress视频教程。 您也可以在TwitterGoogle+上找到我们。

翻译自: https://www.wpbeginner.com/plugins/how-to-reduce-wordpress-comment-spam-with-cookies-for-comments/

减少cookie传输

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值