This is a discussion on mod_rewrite help within the Apache Web Server forums, part of the Web Server and Related Forums category; I'm trying to ban hotlinking from one specific site, and replace the linked images with one telling them not ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm trying to ban hotlinking from one specific site, and replace the linked
images with one telling them not to hotlink from me. This is the contents of the .htaccess in the document root. RewriteEngine on RewriteCond %{HTTP_REFERER} !^http://www\.xxxxxxx\.com/.* [NC] RewriteCond %{REQUEST_URI} ^/.*\.(gif|jpg|jpeg|png|mpg|mpeg|mp4|mp3|mov|avi|wmv |wmf|rm|ram)$ [NC] RewriteCond %{REQUEST_URI} !^/dontsteal.jpg$ RewriteRule ^.*$ /dontsteal.jpg [L] Unfortunately I have a bit of a strange problem. It replaces the images linked from that site (which is what I want) but bans hotlinking from everywhere else (which is what I don't want). Is there a way to fix this? I would really appreciate any help. Many thanks Colin |
|
|||
|
> RewriteCond %{HTTP_REFERER} !^http://www\.xxxxxxx\.com/.* [NC]
> RewriteCond %{REQUEST_URI} > ^/.*\.(gif|jpg|jpeg|png|mpg|mpeg|mp4|mp3|mov|avi|wmv |wmf|rm|ram)$ [NC] > RewriteCond %{REQUEST_URI} !^/dontsteal.jpg$ > RewriteRule ^.*$ /dontsteal.jpg [L] > > Unfortunately I have a bit of a strange problem. It replaces the images > linked from that site (which is what I want) but bans hotlinking from > everywhere else (which is what I don't want). Is there a way to fix this? > I would really appreciate any help. since there's a ! before ^http://www\.xxxxxxx\.com/.*, you allow it for www\.xxxxxxx\.com and forbid for anybody else... you should also think about the fact that many browsers offer a possibility to suppress the referrer. joachim |
| Thread Tools | |
| Display Modes | |
|
|