Prevent Hot Linking With .htaccess

Prevent Hot Linking With .htaccess

am 08.05.2007 17:44:17 von BrianEWilliams

>From this link:

http://www.javascriptkit.com/howto/htaccess10.shtml

I learned that I could prevent hot linking with this code:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule \.(gif|jpg|js|css)$ - [F]

in my .htaccess file.

The only problem is that it doesn't work. I replaced mydomain.com
with the proper domain, but I am still able to hot link images from
another domain I have. The .htaccess file is in the directory
containing the images I don't want hot linked.

If there is something simple to try, I'd love to hear it. The website
is hosted on a GoDaddy shared-hosting Linux server, Apache version
1.3.33.

Also, if some kind soul wanted to explain what the syntax of the code
is or point me to a reference that does, that would be much
appreciated.

Re: Prevent Hot Linking With .htaccess

am 09.05.2007 15:59:59 von BrianEWilliams

On May 8, 11:44 am, EdwardATeller wrote:
> >From this link:
>
> http://www.javascriptkit.com/howto/htaccess10.shtml
>
> I learned that I could prevent hot linking with this code:
>
> RewriteEngine on
> RewriteCond %{HTTP_REFERER} !^$
> RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
> RewriteRule \.(gif|jpg|js|css)$ - [F]
>
> in my .htaccess file.
>
> The only problem is that it doesn't work. I replaced mydomain.com
> with the proper domain, but I am still able to hot link images from
> another domain I have. The .htaccess file is in the directory
> containing the images I don't want hot linked.
>
> If there is something simple to try, I'd love to hear it. The website
> is hosted on a GoDaddy shared-hosting Linux server, Apache version
> 1.3.33.
>
> Also, if some kind soul wanted to explain what the syntax of the code
> is or point me to a reference that does, that would be much
> appreciated.

Any thoughts on this?