PDA

View Full Version : Stopping Hotlinking Images...


FreeHugeMovies
10-15-2001, 11:55 AM
Hey Guys,

Sorry for this subject but what is the code that would protect my images directory from hotlinkers at my domain...
http://www.freehugemovies.com

Also, once I put this file in my images directory. Does is stop hotlinking in a directory like images/tgp ?

Thanks
The Jester

Smitty
10-15-2001, 12:13 PM
AuthUserFile /dev/null
AuthGroupFile /dev/null

RewriteEngine On

RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com.* [NC]
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com.* [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com:80.* [NC]
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com:80.* [NC]
RewriteCond %{HTTP_REFERER} !^http://111.111.111.111.* [NC]
RewriteCond %{HTTP_REFERER} !^http://111.111.111.111:80.* [NC]

RewriteRule /* http://www.yourdomain.com [R,L]


This code goes into a .htacess file. Make sure to replace 111.111.111.111 with your site's IP number.

Jeff Smith

FreeHugeMovies
10-15-2001, 12:28 PM
Thanks Smitty!

I put it at this URL.
http://freehugemovies.com/images/.htacess

But people can still browse my images directory at...
http://freehugemovies.com/images/

Thanks,
The Jester

shunga
10-15-2001, 12:28 PM
Originally posted by TheJester:
<STRONG>Also, once I put this file in my images directory. Does is stop hotlinking in a directory like images/tgp ?</STRONG>

Smitty's code will protect everything in the images directory, including sub-directories, and sub-directories of sub-directories etc.

Smitty
10-15-2001, 12:30 PM
Sorry about that, I mispelled .htaccess. There are two c's. Sorry for the typo.

Jeff Smith

shunga
10-15-2001, 12:30 PM
Originally posted by TheJester:
<STRONG>I put it at this URL.
http://freehugemovies.com/images/.htacess

But people can still browse my images directory at...
http://freehugemovies.com/images/</STRONG>

Jester, you need to put the .htaccess file into the images directory itself, not a directory under it.

FreeHugeMovies
10-15-2001, 12:40 PM
Smitty,

Thank you for your help.

shunga,

Thanks to you too! I put it in the iamges directory. I didn't mean to put the extra / in the end.

Thanks,
The Jester

donger
10-15-2001, 02:26 PM
Originally posted by TheJester:
<STRONG>Thanks Smitty!

I put it at this URL.
http://freehugemovies.com/images/.htacess

But people can still browse my images directory at...
http://freehugemovies.com/images/

Thanks,
The Jester</STRONG>

you need to stick an index file in your images directory or turn off directory browsing in your webserver if you don't want people browsing it. The .htaccess stuff only prevents hotlinking. Just make a page and name it index.html or index.htm and stick it there.

shane
10-15-2001, 03:55 PM
i found this the other day, its a tool to test hotlinking :)
http://www.hotlinking.com/