Forum Moderators: phranque

Message Too Old, No Replies

Disable image hot linking

Are flags right? Or missing something else?

         

smallcompany

5:17 pm on May 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I used some online tool that generates .htaccess entries for few things, like image hot linking prevention. I entered the lines into my .htaccess and found images were gone. I wonder what is wrong, is it about how rules are being applied, including the bad bots part.

Here is the .htaccess:

RewriteEngine On
RewriteBase /
## BAD BOTS
RewriteCond %{HTTP_USER_AGENT} larbin [NC,OR]
RewriteCond %{HTTP_USER_AGENT} libwww [NC,OR]
RewriteCond %{HTTP_USER_AGENT} EmailSiphon [NC,OR]
RewriteCond %{HTTP_USER_AGENT} scoutjet [NC,OR]
RewriteCond %{HTTP_USER_AGENT} turnitinbot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} heritrix [NC]
RewriteRule ^(.*)$ - [F,L]
## DISABLE HOTLINKING
#Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?site.com/.*$ [NC]
RewriteRule \.(gif¦jpg¦jpeg¦png¦js)$ - [F]

I can only guess that flags are not being applied in right manner, but not sure.

Thanks

wilderness

6:27 pm on May 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Try changing these lines to the following

RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http://(www\.)?site\.com [NC]
RewriteRule \.(gif¦jpg¦jpeg¦png¦js)$ - [NC,F]

smallcompany

10:55 pm on May 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This is not working...

but this did work:

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?site\.com/.*$ [NC]
RewriteRule \.(gif¦jpg¦jpeg¦png¦js)$ - [F]

...adding backslash before ".com"

Thanks!