Forum Moderators: phranque
RewriteEngine On
RewriteCond %{HTTP_REFERER}!^http://www.example.com [NC]
RewriteCond %{HTTP_REFERER}!^http://example.com [NC]
RewriteRule [^/]+.(wmv)$ - [F]
It works, it just works too good. I can't view the video on my own site. If I delete the file my video shows up fine but as soon as I put it back I can't view it anymore. Any suggestions?
Be aware that blocking blank referrers (as you are doing with your .jpg files if you use the same basic code) will make your site appear broken to visitors who are behind corporate and ISP caching proxies, e.g. AOL users.
To allow blank referrers, you'd use something like this:
RewriteEngine on
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com [NC]
RewriteRule \.jpe?g$ - [F]
I strongly suggest that referrer-based access control only be used to reduce (not eliminate) unauthorized access when it's not critical to your site security or revenue. The presence and correctness of an HTTP Referer header is simply not reliable enough to base access control on.
Jim
As for video, you have helped me make up my mind for good. I am just going to convert it into flash. At least then I can add a clickable link in the flash so that if someone hotlinks the file it will still link back to my site.