Forum Moderators: phranque
I use the following code in httpd.conf to protect images in some directories. It USED to work, but now does not seem to be... anyone have any ideas?
### Protect Local Images
RewriteEngine On
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule (gif¦jpg¦JPG¦GIF)$-[F,L]
BTW, I checked my apache logs during testing, and I AM passing the reffer field... from the log:
My.IP.it.me - - [26/Aug/2003:09:04:38 -0600] "GET /images/users/693-user_icon.jpg HTTP/1.1" 200 10579 "http://site.using.my images" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02"
Dave
<edit> whoops- my domain name slipped in!</edit>
I figured it out- kinda freaky.
I was using the rewriterul inside a directory area- I just wanted it to protect the images subdirectory (as I do have some public images I keep elsewhere, and I do not want to block those!) So, anyway, that did not work. But when I moved the rewriterule to the base directory, it worked.
So, I changed the code to:
RewriteRule ^/images/.*(gif¦jpg¦JPG¦GIF)$-[F,L]
and that worked!
I do not know if have an option off I need on in the <DIRECTORY /path/to/my/images> area (I did try turning on +FollowSymLinks, no go!)...
dave