Forum Topic: Disallow hotlinking and search engines

Forum: .htaccess Forum : Security • Posted by Ralf Koller • Updated:

I wonder one thing. If i use

<IfModule mod_rewrite.c>
	RewriteCond %{HTTP_REFERER} !^$
	RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomain.de [NC]
	RewriteRule \.(gif|jpe?g?|png)$ - [NC,F,L]
</IfModule>

is it still possible that search engines can index, crawl and provide as search results my images? if in the robots.txt the images folder is explicitly allowed: Allow: /wp-content/uploads/. Cuz basically Google e.g. is hot linking images in their search results? Aren't they? So would that lead to trouble and "penalties" like mentioned here:

https://www.webmasterworld.com/google/4604331.htm

Best regards Ralf

4 Replies to “Disallow hotlinking and search engines”

Jeff Starr
Posted by Jeff Starr

That code requires the referrer to be your own domain. So unless search engines and other bots are directly hitting your image files, then there should be no problem. In other words, the code does exactly what it's intended to do: stop anything other than you from directly linking to your images.

Posted by Ralf Koller •

ahhhh perfect. thanks!

Steve Wharton
Posted by Steve Wharton

Jeff, does the middle line of Ralf's file (above), specifically the ?mydomain.de part have to be changed to my website name such as, ?stevewharton.com? I'm not understanding the mydomain.de portion of that line. Thanks!

Jeff Starr
Posted by Jeff Starr

Yes, that is exactly correct :)