Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disable hotlinking

Status
Not open for further replies.

roeiboot

Technical User
Feb 10, 2002
241
0
0
US
oi~

i have this .htaccess file in my root:

[---]
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^ [NC]
RewriteCond %{HTTP_REFERER} !^ [NC]
RewriteCond %{HTTP_REFERER} !^ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ [R,NC]
[---]

in most cases i tested it works, BUT if i go to the Delphi forum and post a messages like <a href=" image</a> it returns with the 'no linking' graphic. tried various variations on the link in the .htaccess file but nothing helps. what am i doing wrong ?

--
thanks in advance,
rb.
 
are you sure that you want to check the %{HTTP_REFERER} ?!
'cause in case of a forum I suppose that the HTTP_REFERER is other site not one of above ...

PM
 
your URL (delphi forums) has some frames,
and in fact the HTTP_REFERER is

so, I think taht is better to live the just:
RewriteCond %{HTTP_REFERER} !^ [NC]

or better:
RewriteCond %{HTTP_REFERER} !^ [NC]

The `.*$' sequence in a reg_exp is useless, just think


PM
 
PM; thanks.. put the one you gave me in it, now i get a "The page cannot be displayed".

[.htaccess]
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^ [NC]
RewriteCond %{HTTP_REFERER} !^ [NC]
RewriteCond %{HTTP_REFERER} !^ [[NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ [R,NC]
 
predamarcel; the line i had is the same isn't it, anyway i copy 'n pasted it into the .htaccess, see here:

--
ptions +FollowSymlinks
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^ [NC]
RewriteCond %{HTTP_REFERER} !^ [NC]
RewriteCond %{HTTP_REFERER} !^ [NC]
RewriteLogLevel 9
RewriteLog /usr/error-log
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ [R,NC]
--
the .htaccess is in the root, and it results in a error 500, page cannot be displayed.

thanks!
 
check
/usr/error-log file.


by the way what you want to achive with the Rewrite sequence above ?


PM


 
PM; for some reason there no error-log.. anyway, i think i have it working, need to do some more testing.

what i am after is that only people/web-sites i allow can 'hot-link' images.
 
I suppose that your apache is running as uid nobody/http/web/etc...
and has no write access to '/usr' dir.

for this reason the file doesn't exist.


PM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top