.htaccess hotlink banning

  • 15 years ago

    Hi,


    I'm quite new to using .htaccess files and am trying to set mine up to forbid hotlinking. The code I'm using is:


    RewriteCond %{HTTPREFERER}!^$
    RewriteCond %{HTTP
    REFERER}!^http://(www.)?caeus.com/.*$ [NC]
    RewriteRule .(gif¦jpg¦jpeg¦png)$ http://www.caeus.com/errors/angryman.png [R,L]


    However I have a variety of subdomains set up, and if I try to access images through them, it thinks it's another site and replaces them with my angryman image.


    If someone could tell me how to modify my code (and explain if you can - I want to learn) so that it just allows any domain ending in caeus.com (ie. products.caeus.com, hosted.caeus.com etc.) then I'd be very grateful.


    (Also... can I set more than one domain that it allows? Eg. let it allow ebay.co.uk as well - so that I can host photos and use them on there?)


    Thanks.

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debuggers don't remove bugs. They only show them in slow motion.”