Forum Moderators: phranque
I am using mod_rewrite in my .htaccess file to block hotlinking of my images. This is working fine.
However, I need to ALLOW my logo image regardless, because I use it in my email signature and it's being blocked since web mail users and some email clients either don't pass a referrer or pass one that isn't on my domain.
How can I modify my .htaccess to allow unconditional access to my logo.gif file while still blocking hotlinking of all other images?
Below is the code I have:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com/.*$ [NC]
RewriteRule .*\.(gif¦GIF¦JPG¦jpg¦png¦PNG)$ http://example.com/stop.gif
Thanks!
[edited by: jdMorgan at 9:54 pm (utc) on Nov. 24, 2003]
[edit reason] No specific URLs, please [/edit]
If you asked them to install the code and it failed, then the reason would be that posting on this forum changes the "¦" characters in the mod_rewrite code. In order to work, you must replace them with the solid vertical pipe character from your keyboard -- usually Shift-\
Sorry, I forgot to point that out.
If, on the other hand, their version of Apache is so old that it won't support POSIX regular expressions, you probably need a new host.
Jim