This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Redirect based on query string Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Russell124
Newbie
Newbie


Joined: 09 November 2011
Online Status: Offline
Posts: 3
Posted: 09 November 2011 at 9:14am | IP Logged Quote Russell124

RewriteCond %HTTPS off 
RewriteCond Host: (.*) 
RewriteRule (.*) https\://$1$2 [I,RP]

The above rule redirects everything to https which is good but I want to prevent requests with a certain query string from being redirected.

Example:

http://mydomain.com/servlet/pageViewer?excelReport=true&val1=a&val2=b

When the query string contains "excelReport=true" I don't want the request redirected to https.  I have serached the forum and found some examples but none work for my purpose.

Thanks...

Back to Top View Russell124's Profile Search for other posts by Russell124
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 10 November 2011 at 4:09am | IP Logged Quote Anton

Please try using the following set of rules:

RewriteCond %HTTPS off
RewriteCond Host: (.*)
RewriteRule (.*)\?(?!.*excelReport=true.*)(.*) https\://$1$2\?$3 [I,RP]

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


Joined: 09 November 2011
Online Status: Offline
Posts: 3
Posted: 10 November 2011 at 7:21am | IP Logged Quote Russell124

Anton, thanks for the help. 

It almost works.  The syntax you provided is only redirecting requests that contain "excelReport=true".  I want the oposite to happen.  I only want requests that do not contain "excelReport=true" to be redirected.

Back to Top View Russell124's Profile Search for other posts by Russell124
 
Russell124
Newbie
Newbie


Joined: 09 November 2011
Online Status: Offline
Posts: 3
Posted: 10 November 2011 at 7:56am | IP Logged Quote Russell124

Anton, disregard my last post.  Your syntax is working as intended.  My testing was flawed.

Thanks again for your help....
Back to Top View Russell124's Profile Search for other posts by Russell124
 

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