[QUESTION] Block Incoming Traffic Through .HTACCESS File

Roger Marquez

Elite Member
Joined
Apr 17, 2017
Messages
5,126
Reaction score
7,816
Tried editing a site´s .htaccess file to block any incoming traffic from site´s I believe are potentially spammy, low-quality, and/or toxic.

Unfortunately, the code snippet broke the site, and I don´t know why.

So, I would like to run the code through you guys and see if you spot the error.


# Block Referral Traffic From Spammy Sites
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*domain1\.net [NC,OR]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*domain2\.info [NC,OR]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*domain3\.org [NC,OR]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*domain4\.info [NC,OR]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*domain5\.org [NC,OR]

RewriteRule .* - [F]

Thoughts?
 
Getting 403 or other error?

Whoever wrote that for you - they overdid it -https://httpd.apache.org/docs/2.4/rewrite/access.html and try with simple versions and work your way up.
 
Code:
RewriteEngine On
RewriteCond %{HTTP_REFERER} example.com [NC,OR]
RewriteCond %{HTTP_REFERER} example.net [NC]RewriteRule .* - [F]

2nd line the same for multiple domains, and make sure the last one matches 3rd.
 
Loads of info online, try restoring your site to a previous version via cpanel
 
Back
Top