Forum Moderators: phranque
Now I have a question, I have used this in my.htaccess file. This 1st part was in the file already and I added the "rewrite engine on" and what follows. Wasn't sure if the existing things in the file would make a difference, so will post them also.
# -FrontPage-
IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*
order deny,allow
deny from all
allow from all
order deny,allow
deny from all
AuthName www.mysite.com
AuthUserFile /home/mysite/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/mysite/public_html/_vti_pvt/service.grp
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://(www\.)?rpsite.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://(www\.)?mysite.com/subdomain(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://(www\.)?mysite.com/subdomain(/)?.*$ [NC]
RewriteRule .*\.(gif¦jpg¦bmp)$ [mysite.com...] [R,NC]
My question is it seems to work at times but is not consistent. While testing in a forum today, at times I saw the thief.jpeg image and at times I would see the image that I copied and pasted from the site.
Same with other people, some saw the hot-linked image and some saw the thief.jpeg image. Am I doing something wrong?
Thanks in advance for any advise
K
Also at these different times via my site logs, I could check sites hot-linking and see the thief image say in a background they had hot-linked to. Other times I could not.
I would clear my cache and check again and still wouldn't see the thief image. Few hours later I could. This happen several times through out the day. Very strange.
Access protection by referer is not 100% reliable, and we just have to live with it. If you block blank referers, then you will serve your thief image to a significant number of legitimate site visitors. The alternative is to set up an access-control script, and use cookies or sessions to control image access.
I'd like to recomend that you not use an external redirect to serve your thief image. First, because following an external redirect requires the cooperation of the user-agent, and second, because it "exposes" your method.
The code you posted above can be simplified, and the rewrite hidden using:
RewriteEngine on
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http://(www\.)?rpsite.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com/subdomain1 [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com/subdomain2 [NC]
RewriteRule \.(gif¦jpg¦bmp)$ /thief.jpeg [NC,L]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com/(subdomain1¦subdomain2) [NC]
<added> Forgot my manners... Welcome to WebmasterWorld [webmasterworld.com]! </added>
Jim