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\.)? [NC]
	RewriteRule \.(gif|jpe?g?|png)$ - [NC,F,L]

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:

Best regards Ralf

4 Replies to “Disallow hotlinking and search engines”

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!

Posted by Steve Wharton

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

Posted by Jeff Starr

Yes, that is exactly correct :)