View Full Version : .htaccess problem

09-01-2004, 04:05 AM
I wrote this script to disable hotlinking and I can't get it to work. Anyone know how I can make this work ?

<Files .htaccess>
order allow,deny
deny from all
RewriteEngine on RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?project-angel.com/.*$ [NC]
RewriteRule .(jpe?g|gif|bmp|png)$ images/htaccess/hotlink.jpg [L]


09-02-2004, 04:17 AM

09-02-2004, 06:23 PM
Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} !^http://(www\.)?project-angel.com(/)?.*$ [NC]
RewriteRule .*\.(jpeg|gif|bmp|png|jpg)$ http://www.project-angel.com/images/htaccess/hotlink.jpg [R,NC]

09-03-2004, 01:26 AM
I assume this would go after my <files .htaccess> tag ? is there anything else I need ?

09-04-2004, 12:11 PM
Where did you get that <files .htaccess> tag? You just put exactly what I said in the .htaccess, no more, no less.

09-06-2004, 10:03 PM
..no more, no less.

Well.. you have to turn it on first, exclude the hotlink image to allow it being hotlinked to, exclude blank referrers, escape the dots and you don't need the (/)?.*$ at the end of the RewriteCond.
In the RewriteRule, again, you have to escape the second dot (to actually match a dot instead of 'any character') and you don't need the NC flag at the end.

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{REQUEST_URI} !^/images/htaccess/hotlink\.jpg [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?project-angel\.com [NC]
RewriteRule .*\.(jpeg|gif|bmp|png|jpg)$ http://www.project-angel.com/images/htaccess/hotlink.jpg [R,L]