简体   繁体   中英

blocking subdomains spam referrals using .htaccess

I want to block the referrals for the subdomains and the main domain of the spam bots and hence am using the following code.

RewriteEngine on 
RewriteCond %{HTTP_REFERER} ^http://([^.]+\.)*semalt\.com [OR,NC]
RewriteCond %{HTTP_REFERER} ^http://([^.]+\.)*buttons-for-website\.com [OR,NC]
RewriteCond %{HTTP_REFERER} ^http://([^.]+\.)*simple-share-buttons\.com [NC]
RewriteRule .* - [F]

I have hosted my website on awardspace.com.

The problem is that I am still seeing referrals from the subdomains of the above mentioned websites.

Relax your regex further using:

RewriteEngine on 

RewriteCond %{HTTP_REFERER} (buttons-for-website|semalt|simple-share-buttons)\. [NC]
RewriteRule ^ - [F]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM