Gutspiller Posted April 15, 2006 Share Posted April 15, 2006 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:[code]RewriteEngine OnRewriteCond %{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][/code]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] Quote Link to comment Share on other sites More sharing options...
Gutspiller Posted April 19, 2006 Author Share Posted April 19, 2006 Any ideas people? Quote Link to comment Share on other sites More sharing options...
poirot Posted April 19, 2006 Share Posted April 19, 2006 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. Quote Link to comment Share on other sites More sharing options...
Gutspiller Posted April 19, 2006 Author Share Posted April 19, 2006 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? Quote Link to comment Share on other sites More sharing options...
Gutspiller Posted April 19, 2006 Author Share Posted April 19, 2006 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:[code]SetEnvIfNoCase Referer "^http://www.yourdomain.net/" allowed=1SetEnvIfNoCase Referer "^http://yourdomain.net/" allowed=1SetEnvIfNoCase Referer "^$" allowed=1Order Allow,DenyAllow from env=allowed<Files "*.php">Order Allow,DenyDeny from all</Files> [/code] Quote Link to comment Share on other sites More sharing options...
Gutspiller Posted May 2, 2006 Author Share Posted May 2, 2006 bump Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.