Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 3.0 support forum
 Helicon Tech : ISAPI_Rewrite 3.0 support forum
Subject Topic: Ignore certain folders for hot link rule Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
canadaka
Groupie
Groupie


Joined: 18 August 2004
Location: Canada
Online Status: Offline
Posts: 61
Posted: 03 July 2008 at 10:41pm | IP Logged Quote canadaka

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 View canadaka's Profile Search for other posts by canadaka Visit canadaka's Homepage
 
Vyacheslav
Moderator Group
Moderator Group


Joined: 02 July 2008
Location: Ukraine
Online Status: Offline
Posts: 578
Posted: 04 July 2008 at 4:44am | IP Logged Quote Vyacheslav

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 View Vyacheslav's Profile Search for other posts by Vyacheslav Visit Vyacheslav's Homepage
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 4152
Posted: 04 July 2008 at 4:44am | IP Logged Quote Anton

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 View Anton's Profile Search for other posts by Anton
 
canadaka
Groupie
Groupie


Joined: 18 August 2004
Location: Canada
Online Status: Offline
Posts: 61
Posted: 04 July 2008 at 9:16pm | IP Logged Quote canadaka

thanks for the response!

Now I need the 2nd part of my inquery, how to permit hot linking to certain domains.
Back to Top View canadaka's Profile Search for other posts by canadaka Visit canadaka's Homepage
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 4152
Posted: 07 July 2008 at 2:48am | IP Logged Quote Anton

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 View Anton's Profile Search for other posts by Anton
 
canadaka
Groupie
Groupie


Joined: 18 August 2004
Location: Canada
Online Status: Offline
Posts: 61
Posted: 07 July 2008 at 4:44pm | IP Logged Quote canadaka

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 View canadaka's Profile Search for other posts by canadaka Visit canadaka's Homepage
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 4152
Posted: 08 July 2008 at 3:54am | IP Logged Quote Anton

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 View Anton's Profile Search for other posts by Anton
 
canadaka
Groupie
Groupie


Joined: 18 August 2004
Location: Canada
Online Status: Offline
Posts: 61
Posted: 08 July 2008 at 9:38pm | IP Logged Quote canadaka

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 View canadaka's Profile Search for other posts by canadaka Visit canadaka's Homepage
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 4152
Posted: 09 July 2008 at 5:12am | IP Logged Quote Anton

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 View Anton's Profile Search for other posts by Anton
 
canadaka
Groupie
Groupie


Joined: 18 August 2004
Location: Canada
Online Status: Offline
Posts: 61
Posted: 10 July 2008 at 3:29pm | IP Logged Quote canadaka

thanks a lot, that seemed to have done the trick!
Back to Top View canadaka's Profile Search for other posts by canadaka Visit canadaka's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum