Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Coordinating robots.txt and .htaccess


jdMorgan - 7:10 pm on Nov 3, 2002 (gmt 0)


Busynut,

No problem - Answering these q's helps me "earn my keep" around here - I read a lot more than I write!

I understand about blocking image hot-linking only in certain subdirectories, and having a subdirectory-level .htaccess is one way to do it. The other way is to put the subdirectory name in the RewriteRule in your site's root directory. Six of one, half dozen of the other - both work.

Have you "allowed" the Google cache, and the others to hot-link? It's another consideration for you. Here's a snippet that demonstrates both the subdirectory-only-image-blocking and also allowing well-known caches and language translators to hot-link while controlling the rest:


# Block image inclusion outside our domain except Google, AltaVista, Gigablast,
# Comet Systems, and SearchHippo translators and caches
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www\.mydomain\.org
RewriteCond %{HTTP_REFERER} !^http://216\.239\.(3[2-9]¦[45][0-9]¦6[0-3])\..*www\.mydomain\.org
RewriteCond %{HTTP_REFERER} !^http://babel.altavista.com/.*www\.mydomain\.org
RewriteCond %{HTTP_REFERER} !^http://216\.243\.113\.1/cgi/
RewriteCond %{HTTP_REFERER} !^http://search.*\.cometsystems\.com/search.*www\.mydomain\.org
RewriteCond %{HTTP_REFERER} !^http://.*searchhippo\.com.*www\.mydomain\.org
RewriteRule ^image_dir/.*\.(jpg¦jpeg?¦gif)$ - [F,L]

Jim


Thread source:: http://www.webmasterworld.com/apache/262.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com