0

This question is not the same as How to Block Spam Referrers like darodar.com from Accessing Website? as that question hightlight on how to block a specific referer.

This question is about to block any request with Referer set and give them a 404 error.

Community
  • 1
  • 1
user275517
  • 185
  • 1
  • 1
  • 10

2 Answers2

0
RewriteCond %{HTTP_REFERER} .
RewriteRule .* - [F]

Hope that helps.

CollinD
  • 7,304
  • 2
  • 22
  • 45
0

Try in htaccess:

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^https?://(www\.)?example.com [NC]
RewriteRule ^ - [R=404,L]

The example above returns a 404 not found error for all referers from http://www.example.com , you can change the example.com string to domain.com your desired domain to block their referer.

Amit Verma
  • 40,709
  • 21
  • 93
  • 115