How to block access to certain referrers in Apache using .htaccess

October 26, 2018

Here are the rules you need if you want to block access to any request that contains a certain referring URL

RewriteCond %{HTTP_REFERER} bad-site-linking-to-your\.com [NC,OR]
RewriteCond %{HTTP_REFERER} another-bad-site-linking-to-you\.com [NC]
RewriteRule .* - [F]