Web Hosting Talk







View Full Version : .htaccess help?


DaveC#
07-27-2001, 10:33 AM
I want to stop people hotlinking to my images and costing me bandwidth

Heres a snip from my .htaccess


# Rewrite
AuthUserFile /dev/null
AuthGroupFile /dev/null
RewriteEngine On
RewriteCond %{HTTP_REFERER} !>http://cpfc.org [NC]
RewriteCond %{HTTP_REFERER} !>http://www.cpfc.org [NC]
RewriteCond %{HTTP_REFERER} !>http://cpfc-online.com [NC]
RewriteCond %{HTTP_REFERER} !>http://www.cpfc-online.com [NC]
RewriteRule /* http://www.cpfc.org/bad.gif [R,L]


Any idea why the above doesn't work- people are still hotlinking succesfully to images in my /forums directory

Eagle
07-27-2001, 10:44 AM
Try this

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.domain.com [NC]
RewriteCond %{HTTP_REFERER} !^http://domain.com [NC]
RewriteRule [^/]+\.(exe|mpeg|mpg|avi|mp3|gif|jpg|JPG|GIF|MP3|AVI)$ - [F]
RewriteRule ^/cgi-bin/.+$ - [F]