Forum Moderators: phranque

Message Too Old, No Replies

Hotlinking problem

I copied it from a book how can it still not work

         

bubster119

10:23 am on Apr 19, 2007 (gmt 0)

10+ Year Member



Well I've bought myself an Apache book, but the first code I try and implement doesn't work- even though I've copied it directly.

I've created a .htaccess file in my image directory with the following syntax:

<FilesMatch "\.(jpg¦jpeg¦gif¦png)$">
SetEnvIfNoCase Referer "^http://([^/]*\.)?example.com/" local_referrer=1
Order Allow,Deny
Allow from env=local_referrer
</FilesMatch>

The problem is it blocks the images from everyone, even my own site.

I'm running the script in a subdomain of a .tv site- I don't know if that makes any difference.

Anyone got any ideas.

Thanks alot.

[edited by: bubster119 at 10:56 am (utc) on April 19, 2007]

Quadrille

10:36 am on Apr 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



But what are you trying to do?

bubster119

10:39 am on Apr 19, 2007 (gmt 0)

10+ Year Member



Hi Quadrille, I'm trying to stop people from hotlinking images from my site.

bubster119

12:46 pm on Apr 19, 2007 (gmt 0)

10+ Year Member



Nevermind, i went with this instead.

RewriteEngine on
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER}!^http://(www\.)?yoursite\.com [NC]
RewriteRule \.(gif¦jpe?g)$ - [NC,F]

g1smd

12:01 pm on Apr 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Something like

SetEnvIfNoCase Referer !^(www\.)?example\.com local_referrer=1

might have worked.

I also added a \ before .com and removed the trailing / on the URL.