Forum Moderators: phranque
The code I attempted to use at root level is:
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^http://mysite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://mysite.com$ [NC]
RewriteCond %{HTTP_REFERER}!^http://www.mysite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://www.mysite.com$ [NC]
RewriteRule .*\.(gif¦jpg¦jpeg¦css¦ani¦js¦pl¦php)$ http://www.mysite.com/error/nohotlinking.png [R,NC]
Thanks
Moon
Welcome to WebmasterWorld [webmasterworld.com]!
HTTP referrers are unreliable.
Client-side scripting languages generally do not provide a referrrer.
Therefore, you'll need to add
RewriteCond %{HTTP_REFERER} . Actually *all* of your RewriteConds can be replaced by these two lines:
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite\.com [NC]
Unfortunately, allowing blank referrers will allow right-click-save and direct browser address bar type-ins to access your images, but there's not much you can do about it, short of using authentication, sessions, or cookies.
Jim