Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: isapi 2.x & hotlink blocker Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
whizzinisapi
Groupie
Groupie


Joined: 21 May 2004
Location: United States
Online Status: Offline
Posts: 50
Posted: 24 February 2010 at 6:12pm | IP Logged Quote whizzinisapi

Can we add a rule to isapi rewrite to block others from hotlinking? Basically, do what hotlink blocker does with isapi rewrite.
Back to Top View whizzinisapi's Profile Search for other posts by whizzinisapi
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10489
Posted: 25 February 2010 at 3:01am | IP Logged Quote Anton

"Basically, do what hotlink blocker does with isapi rewrite." - well, it's not possible in full, but here's the best you can do:

[ISAPI_Rewrite]
RewriteCond Host: (.+)
RewriteCond Referer: (?!http://\1.*).*
RewriteRule .*\.(?:gif|jpg|png) /block.gif [I,O]

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
whizzinisapi
Groupie
Groupie


Joined: 21 May 2004
Location: United States
Online Status: Offline
Posts: 50
Posted: 04 March 2010 at 2:06pm | IP Logged Quote whizzinisapi

Thank You. We already have some rules in our httpd.ini... how would i add that without it conflicting with anything else.

Below is an example of our httpd.ini.

RewriteCond Host: ^widgets\.com
RewriteRule (.*) http\://www\.widgets.com\.com$1 [I,RP]
RewriteCond Host: (.*)
RewriteRule /bluewidgets(/.*) http\://$1/redwidgets$2 [I,RP]
RewriteRule /([^./]+\.htm) http://www.widgets.com/redwidgets/us/$1 [I,RP,L]
Back to Top View whizzinisapi's Profile Search for other posts by whizzinisapi
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10489
Posted: 05 March 2010 at 4:05am | IP Logged Quote Anton

You should put the blocking portion at the top of your config:

[ISAPI_Rewrite]
RewriteCond Host: (.+)
RewriteCond Referer: (?!http://\1.*).*
RewriteRule .*\.(?:gif|jpg|png) /block.gif [I,O]

RewriteCond Host: ^widgets\.com
RewriteRule (.*) http\://www\.widgets.com\.com$1 [I,RP]

RewriteCond Host: (.*)
RewriteRule /bluewidgets(/.*) http\://$1/redwidgets$2 [I,RP]
RewriteRule /([^./]+\.htm) http\://www.widgets.com/redwidgets/us/$1 [I,RP]

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
whizzinisapi
Groupie
Groupie


Joined: 21 May 2004
Location: United States
Online Status: Offline
Posts: 50
Posted: 05 March 2010 at 2:27pm | IP Logged Quote whizzinisapi

Thanks Anton... one more thing. It seems this is effecting
https requests on our own domain. any page that is https is
not displaying the images.
Back to Top View whizzinisapi's Profile Search for other posts by whizzinisapi
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10489
Posted: 09 March 2010 at 5:10am | IP Logged Quote Anton

Ok, let's fix the config like this:

[ISAPI_Rewrite]
RewriteCond %HTTPS (?!on).*
RewriteCond Host: (.+)
RewriteCond Referer: (?!http://\1.*).*
RewriteRule .*\.(?:gif|jpg|png) /block.gif [I,O]

RewriteCond %HTTPS (?!on).*
RewriteCond Host: ^widgets\.com
RewriteRule (.*) http\://www\.widgets.com\.com$1 [I,RP]

RewriteCond %HTTPS (?!on).*
RewriteCond Host: (.*)
RewriteRule /bluewidgets(/.*) http\://$1/redwidgets$2 [I,RP]

RewriteCond %HTTPS (?!on).*
RewriteRule /([^./]+\.htm) http\://www.widgets.com/redwidgets/us/$1 [I,RP]

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 

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