Forum Moderators: phranque

Message Too Old, No Replies

Robot control script and image hotlinking problem

         

pinkopanter

4:19 am on May 4, 2004 (gmt 0)

10+ Year Member



Hi,

I use a Robot Control script but the problem that I have is that when I activate the image hotlinking code all of my images are not showing in the browser. They simply disappear. Is there anything I can do to fix that?
Here is the .htaccess file that I have.


<snip>
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://www.mysite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://mysite.com/.*$ [NC]
#-# RewriteCond %{HTTP_REFERER}!^http://www.YourSecondSite.com/.*$ [NC]
#-# RewriteCond %{HTTP_REFERER}!^http://YourSecondSite.com/.*$ [NC]
RewriteRule .*\.(gif¦GIF¦jpg¦JPG)$ [mysite.com...] [R]
<snip>

Thanks

[edited by: jdMorgan at 5:03 am (utc) on May 4, 2004]
[edit reason] Trimmed proprietary/unrelated code [/edit]

jdMorgan

2:40 pm on May 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



pinkopanter,

I hope you figured this one out already, but it looks like the problem might have been a recursive redirect... Note that the request for the replacement image would have been redirected as well, ad infinitum.

You can speed this code up a bit and simplify it, too:
<code>
RewriteEngine on
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite\.com [NC]
# RewriteCond %{HTTP_REFERER} !^http://(www\.)?YourSecondSite\.com [NC]
RewriteCond %{REQUEST_URI} !^/robot/bad\.gif$
RewriteRule \.(gif¦jpg)$ /robot/bad.gif [NC,L]
</code>
This also removes the external redirect required by the original version, using an internal rewrite instead, and therefore it 'hides' the action of image replacement from the hotlinkers.

Jim