| Author |
|
canadaka Groupie

Joined: 18 August 2004 Location: Canada
Online Status: Offline Posts: 61
|
| Posted: 03 July 2008 at 10:41pm | IP Logged
|
|
|
I had a rule in ISAPI_Rewrite2 that allowed me to exclude certain folders from the hot linkingg blockage rule, but i'm unsure how to do this in version 3.
THis is the rule I am using, that works to block all images.
RewriteCond %{HTTP:Host}#%{HTTP:Referer} ^([^#]+)#(?!http://\1).+
RewriteRule .*\.(?:gif|jpg|png|swf|flv) /images/hotlinking.png [NC]
I also would like to know how to allow certain domains to hotlink an image even outside the ignored folders.
|
| Back to Top |
|
| |
Vyacheslav Moderator Group

Joined: 02 July 2008 Location: Ukraine
Online Status: Offline Posts: 578
|
| Posted: 04 July 2008 at 4:44am | IP Logged
|
|
|
Hi canadaka!
You can use different .htaccess files for different folders. So everyone .htaccess file apply rules to folder, where it placed (and subfolders also).
__________________ Kind regards!
Vyacheslav Shinkarenko, HeliconTech.
|
| Back to Top |
|
| |
Anton Moderator Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 4152
|
| Posted: 04 July 2008 at 4:44am | IP Logged
|
|
|
Please try the following rule:
RewriteCond %{HTTP:Host}#%{HTTP:Referer} ^([^#]+)#(?!http://\1).+
RewriteRule (?!excludefolder1|excludefolder2).*\.(?:gif|jpg|png|swf|flv) /images/hotlinking.png [NC]
__________________ Regards,
Anton
|
| Back to Top |
|
| |
canadaka Groupie

Joined: 18 August 2004 Location: Canada
Online Status: Offline Posts: 61
|
| Posted: 04 July 2008 at 9:16pm | IP Logged
|
|
|
thanks for the response!
Now I need the 2nd part of my inquery, how to permit hot linking to certain domains.
|
| Back to Top |
|
| |
Anton Moderator Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 4152
|
| Posted: 07 July 2008 at 2:48am | IP Logged
|
|
|
Provided rule does allow hot linking for excludefolder1 and excludefolder2. If you need to allow it for some domains, the rule will be: RewriteCond %{HTTP:Host}#%{HTTP:Referer} ^(?!excludedomain1|excludedomain2)([^#]+)#(?!http://\1).+
RewriteRule ^.*\.(?:gif|jpg|png|swf|flv)$ /images/hotlinking.png [NC]
__________________ Regards,
Anton
|
| Back to Top |
|
| |
canadaka Groupie

Joined: 18 August 2004 Location: Canada
Online Status: Offline Posts: 61
|
| Posted: 07 July 2008 at 4:44pm | IP Logged
|
|
|
the rule with excludedomain1 doens't seem to work, the images are still being blocked even after a restart of IIS.
RewriteCond %{HTTP:Host}#%{HTTP:Referer} ^(?!domain1.com|domain2.com)([^#]+)#(?!http://\1).+
|
| Back to Top |
|
| |
Anton Moderator Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 4152
|
| Posted: 08 July 2008 at 3:54am | IP Logged
|
|
|
Please try the following config:
RewriteCond %{HTTP_HOST} ^(?!(?:www\.)?(?:domain1\.com|domain2\.com)).+$ [NC] RewriteCond %{HTTP_HOST}#%{HTTP_REFERER} ^([^#]+)#(?!http://\1).+
RewriteRule ^.*\.(?:gif|jpg|png|swf|flv)$ /images/hotlinking.png [NC]
__________________ Regards,
Anton
|
| Back to Top |
|
| |
canadaka Groupie

Joined: 18 August 2004 Location: Canada
Online Status: Offline Posts: 61
|
| Posted: 08 July 2008 at 9:38pm | IP Logged
|
|
|
hmm that doens't work either, the images are still being blocked.
RewriteCond %{HTTP_HOST} ^(?!(?:www\.)?(?:3dvixens\.com|virtuallyjenna\.com|hustler3d\.com)).+$ [NC]
RewriteCond %{HTTP_HOST}#%{HTTP_REFERER} ^([^#]+)#(?!http://\1).+
RewriteRule ^.*\.(?:gif|jpg|png|swf|flv)$ /images/hotlinking.png [NC]
used the excludefolder doens't work either, images are still blocked.
RewriteRule (?!images/news/thumbs).*\.(?:gif|jpg|png|swf|flv) /images/hotlinking.png [NC]
(WARNING NSFW!)
The source images are on gamerotica.com and they're being loaded in an RSS feed on virtuallyjenna.com/news.php
I really need this figured out, I am going to be upgrading another server which is running the older ISAPI_Rereite 2 to the new 3 version and will need rules like this for that server as well. I have a rule that works fine in version 2 for allowing certain domains and excluding certain folders.
Thanks for the help!
|
| Back to Top |
|
| |
Anton Moderator Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 4152
|
| Posted: 09 July 2008 at 5:12am | IP Logged
|
|
|
Please try the following config:
RewriteBase /
RewriteCond %{HTTP_HOST} ^(?!(?:www\.)?(?:3dvixens\.com|virtuallyjenna\.com|hustler3d\.com)).+$ [NC]
RewriteCond %{HTTP_HOST}#%{HTTP_REFERER} ^([^#]+)#(?!http://\1).+ RewriteRule ^(?!images/news/thumbs).*\.(?:gif|jpg|png|swf|flv)$ /images/hotlinking.png [NC]
And if it doesn't work, please provide rewrite log records for the specific request.
__________________ Regards,
Anton
|
| Back to Top |
|
| |
canadaka Groupie

Joined: 18 August 2004 Location: Canada
Online Status: Offline Posts: 61
|
| Posted: 10 July 2008 at 3:29pm | IP Logged
|
|
|
thanks a lot, that seemed to have done the trick!
|
| Back to Top |
|
| |