如何在htaccess中组合这些行?

时间:2018-01-21 00:27:56

标签: php wordpress .htaccess mod-rewrite

机器人正在访问我的网站并在0秒内离开,因此100%退出。我试图在Wordpress中使用htaccess文件来阻止这种情况。 第一行阻止直接访问ref攻击, 第二行防止垃圾邮件域, 但他们不能一起工作。 如何在htaccess中组合这些行? 我已更新代码并输入完整的htaccess: RewriteEngine On #ref垃圾邮件块 RewriteCond%{THE_REQUEST} \?(ref =。*)?\ HTTP [NC,OR] RewriteRule。? HTTP://www.hqtunes.com% {REQUEST_URI}? [R = 301,L] 和 < IfModule mod_rewrite.c> RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* uptime-as \ .net [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* uptime-us \ .net [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* uptime-eu \ .net [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* hulfingtonpost \ .com [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* apanews \ .com [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* adcash \ .com [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* aliexpress \ .com [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* bestwebsitesawards \ .com [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* buttons-for-website \ .com [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* bycontext \ .com [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* cenokos \ .ru [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* cenoval \ .ru [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* cityadspix \ .ru [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* darodar \ .com [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* econom \ .co [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* edakgfvwql \ .ru [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* gobongo \ .info [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* ilovevitaly \ .com [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* ilovevitaly \ .info [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* ilovevitaly \ .org [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* ilovevitaly \ .ru [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* iskalko \ .ru [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* jollygame \ .net [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* luxup \ .ru [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* max-start \ .com [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* o-o-6-o-o \ .ru [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* o-o-8-o-o \ .ru [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* priceg \ .com [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* savetubevideo \ .com [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* screentoolkit \ .com [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* semalt \ .com [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* seoexperimenty \ .ru [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* slftsdybbg \ .ru [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* socialseet \ .ru [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* superiends \ .org [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* vodkoved \ .ru [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* sites-reviews \ .com [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* websocial \ .me [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* ykecwqlixx \ .ru [NC] RewriteCond%{HTTP_REFERER} ^ https?://([^。] + \。)* simpleshare-buttons \ .com [NC] RewriteRule ^。* - [F,L] < / IfModule> SetEnvIfNoCase Referer uptime-as.net spammer = yes SetEnvIfNoCase Referer uptime-us.net spammer = yes SetEnvIfNoCase Referer uptime-eu.net spammer = yes SetEnvIfNoCase Referer hulfingtonpost.com spammer = yes SetEnvIfNoCase Referer apanews.com spammer = yes SetEnvIfNoCase Referer adcash.com spammer = yes SetEnvIfNoCase Referer aliexpress.com spammer = yes SetEnvIfNoCase Referer bestwebsitesawards.com spammer = yes SetEnvIfNoCase Referer buttons-for-website.com spammer = yes SetEnvIfNoCase Referer semalt.com spammer = yes SetEnvIfNoCase Referer bycontext.com spammer = yes SetEnvIfNoCase Referer cenokos.ru spammer = yes SetEnvIfNoCase Referer cenoval.ru spammer = yes SetEnvIfNoCase Referer cityadspix.ru spammer = yes SetEnvIfNoCase Referer darodar.com spammer = yes SetEnvIfNoCase Referer econom.co spammer = yes SetEnvIfNoCase Referer edakgfvwql.ru spammer = yes SetEnvIfNoCase Referer gobongo.info spammer = yes SetEnvIfNoCase Referer ilovevitaly.com spammer = yes SetEnvIfNoCase Referer ilovevitaly.org spammer = yes SetEnvIfNoCase Referer ilovevitaly.info spammer = yes SetEnvIfNoCase Referer ilovevitaly.ru spammer = yes SetEnvIfNoCase Referer iskalko.ru spammer = yes SetEnvIfNoCase Referer jollygame.net spammer = yes SetEnvIfNoCase Referer luxup.ru spammer = yes SetEnvIfNoCase Referer max-start.com spammer = yes SetEnvIfNoCase Referer o-o-6-o-o.ru spammer = yes SetEnvIfNoCase Referer o-o-8-o-o.ru spammer = yes SetEnvIfNoCase Referer priceg.com spammer = yes SetEnvIfNoCase Referer savetubevideo.com spammer = yes SetEnvIfNoCase Referer screentoolkit.com spammer = yes SetEnvIfNoCase Referer seoexperimenty.ru spammer = yes SetEnvIfNoCase Referer slftsdybbg.ru spammer = yes SetEnvIfNoCase Referer socialseet.ru spammer = yes SetEnvIfNoCase Referer superiends.org spammer = yes SetEnvIfNoCase Referer vodkoved.ru spammer = yes SetEnvIfNoCase Referer sites-reviews.com spammer = yes SetEnvIfNoCase Referer websocial.me spammer = yes SetEnvIfNoCase Referer ykecwqlixx.ru spammer = yes SetEnvIfNoCase Referer simpleshare-buttons.com spammer = yes 订单允许,拒绝 允许所有人 拒绝来自env = spammer

1 个答案:

答案 0 :(得分:1)

您可以将此单个组合规则与多个OR子句一起使用:

RewriteEngine On 

RewriteCond %{THE_REQUEST} \?(ref=.*)?\ HTTP [NC,OR]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*uptime-as\.net [NC,OR] 
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*uptime-us\.net [NC,OR] 
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*uptime-eu\.net [NC,OR] 
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*hulfingtonpost\.com [NC]
RewriteRule ^ - [F,L]