【问题标题】:Using .htaccess to block referrer spam with wildcard subdomains使用 .htaccess 来阻止带有通配符子域的引用垃圾邮件
【发布时间】:2014-10-15 13:18:33
【问题描述】:

我一直在尝试使用类似于下面显示的 .htaccess 代码阻止一些推荐垃圾邮件到我们的 WordPress 网站。

这似乎在阻止主域 (semalt.com) 和明确定义的子域 (semalt.semalt.com) 方面相当有效。

但是,通配符子域(即 1.semalt.com、2.semalt.com)似乎通过了过滤器。

这段允许通配符子域通过的代码有什么明显错误吗?

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# block spammers
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*semalt\.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*kambasoft\.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*savetubevideo\.com [NC,OR]
RewriteCond %{HTTP_REFERER} semalt\.semalt\.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*seoanalyses\.com [NC]
RewriteRule .* - [F]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

此外,我已设法将流减少到涓涓细流,因此 htaccess 代码可能是正确的,而垃圾邮件发送者正在通过其他方式绕过。谢谢!

【问题讨论】:

  • 更新:我发现托管公司 (WPengine) 有一个 Nginx 层,它优先于 Apache 上的 .htaccess。当主机在 Nginx 上实施域块时,推荐垃圾邮件降至零(对于那些域)。
  • 而且,虽然我确信代码不是最优的,但它在阻止直接 Apache 服务器上的那些引荐来源(及其通配符子域)方面非常有效。
  • 另一个附录。事实证明,要阻止实际的引荐来源垃圾邮件和要阻止的“幽灵”引荐来源垃圾邮件。更多信息在这里:link

标签: wordpress apache .htaccess mod-rewrite


【解决方案1】:

有成千上万的此类网站向博客和论坛发送垃圾邮件,唯一的解决方案是使用 .htaccess 阻止垃圾邮件引荐网站,但这并不是消除您网站上的垃圾邮件点击的解决方案。您还需要配置 Google Analytical 工具。您可以尝试以下代码(已测试)

RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://.*ilovevitaly\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*success\-seo\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*ilovevitaly.\.ru/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*ilovevitaly\.org/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*ilovevitaly\.info/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*iloveitaly\.ru/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*floating\-share\-buttons\.com/ [NC,OR] 
RewriteCond %{HTTP_REFERER} ^http://.*econom\.co/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*savetubevideo\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*kambasoft\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*buttons\-for\-website\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*.Get\-Free\-Traffic\-Now\.com/ [NC,OR] 
RewriteCond %{HTTP_REFERER} ^http://.*.free\-social\-buttons\.com/ [NC,OR] 
RewriteCond %{HTTP_REFERER} ^http://.*semalt\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*darodar\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*best\-seo\-report\.com/ [NC]
RewriteRule ^(.*)$ – [F,L]

另见Getting rid of spam referral hits on your website or blog

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多