Jump to content


Photo

htaccess to block images called by watermark.php?


  • Please log in to reply
5 replies to this topic

#1 Gutspiller

Gutspiller
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 15 April 2006 - 10:21 PM

The script works fine by itself, but calls medium and fullsize images through a watermark.php file, but not thumbnails. I want to keep the thumbnails hotlinkable while blocking the medium and fullsize images that are called through this watermark.php file. Is there a way to have a htaccess block the hotlinking of images from my site that are called through this watermark.php file? I tried this:


RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?domain\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpe?g|gif|bmp|png|php|PHP)$ http://www.domain.com/images/banners/hotlinker.gif [L]


But it didn't work and still allows images to be hotlinked. Any ideas?

(I don't know enough programming to tell the script to store the images in different directories than the thumbs so that won't work)

EDIT: The medium size url looks like this: [a href=\"http://www.domain.com/images/watermark.php?file=107&size=1\" target=\"_blank\"]http://www.domain.com/images/watermark.php?file=107&size=1[/a]

and the fullsize image url looks like this: [a href=\"http://www.domain.com/images/watermark.php?file=107\" target=\"_blank\"]http://www.domain.com/images/watermark.php?file=107[/a]

#2 Gutspiller

Gutspiller
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 19 April 2006 - 01:51 AM

Any ideas people?

#3 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 19 April 2006 - 03:20 AM

First, you shouldn't use this to prevent hotlinking since some firewalls, some user-agents (browsers) may block or not send or modify the HTTP_REFERER header so it's not a reliable thing.

Instead, you should make watermark.php itself restrict these bigger images from being hotlinked.
~ D Kuang

#4 Gutspiller

Gutspiller
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 19 April 2006 - 03:44 PM

It's someone elses script and I don't know coding. Getting an htaccess to block php hotlinking seems (if possible) to be the easiest way for me to get this accomplished.

Does anybody know how to get the htaccess to block php hotlinking?

#5 Gutspiller

Gutspiller
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 19 April 2006 - 04:09 PM

I found these two resources, but I don't know enough to change them to fit my site:

[a href=\"http://www.vbulletin.org/forum/showthread.php?p=609945\" target=\"_blank\"]http://www.vbulletin.org/forum/showthread.php?p=609945[/a]
[a href=\"http://forums.invisionpower.com/lofiversion/index.php/t191265.html\" target=\"_blank\"]http://forums.invisionpower.com/lofiversio...hp/t191265.html[/a]

Can somebody please help me sort out a working version of the htaccess that will block a watermark.php file?

EDIT: I also tried this that I was given by someone else and it didn't work either:

SetEnvIfNoCase Referer "^http://www.yourdomain.net/" allowed=1
SetEnvIfNoCase Referer "^http://yourdomain.net/" allowed=1
SetEnvIfNoCase Referer "^$" allowed=1

Order Allow,Deny
Allow from env=allowed

<Files "*.php">
Order Allow,Deny
Deny from all
</Files> 


#6 Gutspiller

Gutspiller
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 02 May 2006 - 05:34 PM

bump




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users