Forum Moderators: phranque

Message Too Old, No Replies

hotlinking images

         

stefan009

8:35 am on Oct 14, 2005 (gmt 0)

10+ Year Member



I have lines to prevent hotlinking in .htaccess

Just noticed this morning that Google is using a url [images.google.ca...] etc..

To link up to images!

By clicking on the image -> google then displays the image?

Can anyone help here? I'm using script from the .htaccess ban list thread posted a few years ago, that does prevent conventional hotlinking as this has been tested.

Thank you. Steve

dcrombie

10:48 am on Oct 14, 2005 (gmt 0)



Yes but what's your question?

stefan009

12:07 pm on Oct 14, 2005 (gmt 0)

10+ Year Member



Google appears to be hotlinking all the images by the use of its image search engine, when the image is clicked on inside the google page, the htaccess would be expected to prevent the image from being displayed (hotlinked)

It isn't doing that and I am wondering if anyone knows how to prevent it because I have images, of course, I don't want displayed, they are for internal use.

Any help would be much appreciated, Steve.

RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://myUrl.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://www.myUrl.com/.*$ [NC]
RewriteRule .*\.(avi¦bmp¦css¦doc¦exe¦gif¦jpg¦js¦mdb¦mid¦mov¦mp3¦mpg¦pdf¦png¦pps¦ppt¦ra¦ram¦swf¦wav¦wma¦xls¦zip¦jpg¦jpeg¦gif¦png¦bmp)$ [myUrl.com...] [R,NC]

wilderness

4:11 pm on Oct 14, 2005 (gmt 0)

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



Googlebot honors robots.txt

User-agent: Googlebot-Image
Disallow: /

Another long range method of reducing spiders from crawling your images is to create a directory specifically for images.
a) The add that folder to robots.text
b) It's also a good idea to give images a numbers rather than a name to reduce search refernces.
Ex: It's much easier to search for an image named "house" than it for an image named "00001"

I use a method to reduce hot-linking very similar to yours, however I do not redirect to another page or image, rather, I deny.
This method has been effective for over six years.

jdMorgan

4:28 pm on Oct 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try this cleaned-up version with and without the first line, and see if anything changes. You will have to replace the broken pipe "¦" character with a solid pipe from your keyboard before use:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER}!^http:/(www\.)?/myUrl.com [NC]
RewriteRule \.(avi¦bmp¦css¦doc¦exe¦gif¦jpe?g¦js¦mdb¦mid¦mov¦mp3¦mpg¦pdf¦png¦pp[st]¦ram?¦swf¦wav¦wma¦xls¦zip)$ - [F]

This compresses the check for a blank user-agent to one character, compresses the check for you own domain into one line, eliminates duplicate filetypes, removes unnecessary regex tokens, compresses the checks for several filetypes* into one pattern, and creates a 403-Forbidden response instead of redirecting.

* Note: jpe?g = jpg¦jpeg, pp[st] = pps¦ppt, and ram? = ra¦ram

Again. change the broken pipe characters to solid pipes from your keyboard before use. Flush your browser cache between tests, otherwise your browser will show the image cached on your computer, and these rules on your server can have no effect. Check your raw server access log to get more information about requests that seem to be successful.

Jim

dcrombie

4:32 pm on Oct 14, 2005 (gmt 0)



Small typo in the above:

RewriteCond %{HTTP_REFERER} !^http://(www\.)?myUrl.com [NC]

(added a space before '!' and moved the second / after http:/) ;)