[thelist] Block a Referring URL

Jono jono at charlestonwebsolutions.com
Mon Mar 13 18:21:27 CST 2006


> The following .htaccess should work, assuming the Apache server is
> configured to allow rewriting in the directory(s) in question:
> 
>    RewriteEngine on
>    RewriteCond %{HTTP_REFERER} ^http://.*company-one.*$ [NC]
>    RewriteRule  .* http://company-two.com/some_file.html [R]
> 
> This will redirect links from company-one.com (or other TLDs they may
> have, such as .net, etc) to a file of your choosing on company-two.com
> 
> If you don't want to redirect, change the third line to:
> 
>    RewriteRule .* - [F]
> 
> ...which should produce a '403 Forbidden' result.

Thank you(!), I will give this a shot tomorrow A.M. and see how it works.  I
was getting close (sort of) to this solutions while tinkering with another
.htaccess suggestions, but I did not try (or know about) the "*" character
which I'm guessing serves as a wild card of sorts.  I definitely need to
learn more about .htaccess.

Thanks again!

-- 
Jono Young
Designer | Developer | Illustrator
Charleston Web Solutions
"Bringing Higher Standards to the Lowcountry"
http://www.charlestonwebsolutions.com/






More information about the thelist mailing list