Back htaccess

Block unwanted visitor based on referring domain

WRITTEN BY ON 02 Mar 2014
3,724 VIEWS • SHARES
0 comments

You can define a list of websites from linking to your site by checking http_referrer with htaccess.

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{HTTP_REFERER} scumbag.com [NC,OR]
 RewriteCond %{HTTP_REFERER} wormhole.com [NC,OR]
 RewriteRule .* - [F]
</ifModule>
Join the discussion

Comments will be moderated and rel="nofollow" will be added to all links. You can wrap your coding with [code][/code] to make use of built-in syntax highlighter.