I'm seeing thousands of referrals coming from Russia and China every month from the domains below, I've tried adding the code below to my .htaccess file, and then testing it from another domain I own, but I don't appear to be getting the 403 Forbidden message I'm expecting to get. What am I missing?
RewriteCond %{HTTP_REFERER} ^(www\.)?([a-z0-9-]+)\.social-buttons\.com$ [NC]
RewriteCond %{HTTP_REFERER} social-buttons\.com [NC]
RewriteCond %{HTTP_REFERER} googlsucks\.com [NC]
RewriteCond %{HTTP_REFERER} 4webmasters\.org [NC]
RewriteCond %{HTTP_REFERER} aliexpress\.com [NC]
RewriteCond %{HTTP_REFERER} best-seo-solution\.com [NC]
RewriteCond %{HTTP_REFERER} best-seo-offer\.com [NC]
RewriteCond %{HTTP_REFERER} buttons-for-website\.com [NC]
RewriteCond %{HTTP_REFERER} www\.myothertestdomain\.com [NC]
RewriteRule .* - [F]
Your current code means:
If referer is "sociel-buttons.com"
AND
If referer is "googlsucks.com"
AND
etc...
Which is not what you want (always false: that's why it never happens).
Instead, you have to use OR
flag (you want OR
boolean conditions in your case)
RewriteCond %{HTTP_REFERER} ^(www\.)?([a-z0-9-]+)\.social-buttons\.com$ [NC,OR]
RewriteCond %{HTTP_REFERER} social-buttons\.com [NC,OR]
RewriteCond %{HTTP_REFERER} googlsucks\.com [NC,OR]
RewriteCond %{HTTP_REFERER} 4webmasters\.org [NC,OR]
RewriteCond %{HTTP_REFERER} aliexpress\.com [NC,OR]
RewriteCond %{HTTP_REFERER} best-seo-solution\.com [NC,OR]
RewriteCond %{HTTP_REFERER} best-seo-offer\.com [NC,OR]
RewriteCond %{HTTP_REFERER} buttons-for-website\.com [NC,OR]
RewriteCond %{HTTP_REFERER} www\.myothertestdomain\.com [NC]
RewriteRule ^ - [F]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With