[Wolves] one for you apache experts

Simon Morris simon.morris at cmtww.com
Mon Mar 27 08:37:55 BST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Baza wrote:
> OK, here's my problem. Someone has put a link to my blog on a site I 
> would not want to be associated with.
> 
> I'm running apache 2 on my webserver, is there some way to block 
> traffic from this referrer, so when they hit the link there my server 
> refuses their request?
> 

Hi Baza,

You can use mod_rewrite to do this..

I haven't tested this bit of configuration but I use something very
similar on a few sites

- -----
RewriteEngine On
#RewriteLog /var/log/apache2/rewrite.log < This is optional but useful
for debugging
#RewriteLogLevel 5 < Same here

RewriteCond %{HTTP_REFERER} somedodgywebsite.com
RewriteRule /(.*) http://baz's-website.com/redirectpage.html [P]
- -----

Replace somedodgywebsite.com with the name of the domain that is
referring you to your site, or you could even use the full URL that is
linking to you if you want to be more granular

Replace "http://baz's-website.com/redirectpage.html" with a URL on your
site that says "Hi, you have come here from such and such a site.. blah
blah blah."

Let me know if that works - I'm interested to know.

Thanks


~sm
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEJ6S6tjeLJb8KijsRAi8IAJ9/cJ7PGraoodHPR5fa9JoBbw56sQCgrPCJ
BuU3KEUfY/0yt26IVr2KbHw=
=YtDT
-----END PGP SIGNATURE-----



More information about the Wolves mailing list