how to block requests referred from a particular website?

Topics: User Forum
Sep 12, 2006 at 6:31 PM
Message follows:

My websites are hosted by, they use the IIRF filter.
Now I have a question:
I want to block visitors from a website with a 403 or 404 page in return when
they try to visit my page.
This is the code I try to use:
RewriteCond Referer: http\://www\.blocksite\.com.*
RewriteRule .* /403.php I,L

This code is not working well, Can you please help me with the correct code?

Thanks in advance,
best regards,
Sep 25, 2006 at 11:06 PM
Following up,

HTTP_REFERER will get a full URL, including the page name, not just a simple hostname. so you want to specify http://www\.spiritiny\.com or elsewise, handle the http:// prefix in the regular expression. Something like

RewriteCond %{HTTP_REFERER} ^http://(www\.spiritiny\.com).*$