How to block referrer from single domain and multiple domains

Use the following rewrite rule to block the referrer from single domain/web site.

RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} test\.com [NC]
RewriteRule .* – [F]

Similarly you can block the referrer from the multiple sites by using the following rewrite rule in the .htaccess file.

RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} test\.com [NC,OR]
RewriteCond %{HTTP_REFERER} test123\.com
RewriteRule .* – [F]

About Anant 386 Articles
Senior technical writer