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 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Help pls! Helicon rule not firing
Author
Message |
himesh
Newbie


Joined: 22 October 2010
Posts: 5
Posted: 22 October 2010 at 2:52am

Hey everyone,

I'm struggling trying to get a rewrite working. I need helicon to grab a URL like this:
http://dev.mysite.net/subdir/default.aspx
and redirect it to
https://dev.mysite.net/secure/subdir/default.aspx
for reasons not so important to this post :)

Using the RegexTester app I've come up with this:
RewriteCond  %HTTP_HOST (.*)
RewriteRule (.*)([^\bsecure])(/subdir/default.aspx)(.*) https\://$1$2/secure1$3$4 [R]

Note in the regex pattern the I've had to guard against a redirect loop (...([^\bsecure])...). Anyway, the above works as expected when testing with the RegexTest application. But gets totally ignored when I copy it to the httpd.ini file. By replacing the rewrite rule with this:

RewriteRule (.*)([^\bsecure])(/subdir/default.aspx)(.*) http://www.google.co.za [R]

I was able to determine that it's the guard against the redirect loop that's causing the issue but I have no idea how to fix this.

Test strings:
Should match and get rewritten: dev.mysite.net/subdir/default.aspx
Should not match and be ignored: dev.mysite.net/secure/subdir/default.aspx

I would really appreciate any help guys!

thanks!
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 22 October 2010 at 4:53am

Please, try using the following:

RewriteCond %{HTTPS} off
RewriteCond %HTTP_HOST (.*)
RewriteRule /subdir/(.*) https://www.$1/secure/subdir/$2 [PR,I]

Regards
Andrew


Edited by AndrushkaUS - 22 October 2010 at 4:59am
Back to Top
 
himesh
Newbie


Joined: 22 October 2010
Posts: 5
Posted: 22 October 2010 at 6:54am

Thanks for getting back to me quickly. This is quite urgent!

I've had to make some changes to your feedback (in red):
RewriteCond %HTTPS off?
RewriteCond %HTTP_HOST (.*)
RewriteRule /subdir/(.*) https://www.$1/secure/subdir/$2 [PR,I]

But I'm getting the following error on the httpd.parse.errors file:
Unrecognized string: RewriteRule /marketplace/(.*) https://www.$1/secure/subdir/$2 [PR,I]
Back to Top
 
himesh
Newbie


Joined: 22 October 2010
Posts: 5
Posted: 22 October 2010 at 6:57am

Sorry, just to add to what I'm trying to achieve:

The redirect must only happen for the default.aspx page within the subdir:

http://dev.mysite.net/subdir/default.aspx
and redirect it to
https://dev.mysite.net/secure/subdir/default.aspx
Back to Top
 
himesh
Newbie


Joined: 22 October 2010
Posts: 5
Posted: 22 October 2010 at 6:59am

Please ignore the "marketplace" text in place of "subdir" above.

"But I'm getting the following error on the httpd.parse.errors file:
Unrecognized string: RewriteRule /marketplace/(.*) https://www.$1/secure/subdir/$2 [PR,I]"

I did use it correctly in my test :)
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 22 October 2010 at 8:27am

Pardon me,

I guess there was made a mistake:

RewriteCond %HTTPS off?
RewriteCond %HTTP_HOST (.*)
RewriteRule /subdir/(.*) https://www.$1/secure/subdir/$2 [RP,I]

Regards
Andrew
Back to Top
 
himesh
Newbie


Joined: 22 October 2010
Posts: 5
Posted: 26 October 2010 at 9:14am

Hi,

I'm still not winning with this. With only the following in my httpd.ini file the url seems to be rewritten a second time even though it's under https:

RewriteCond %HTTPS off?
RewriteCond %HTTP_HOST (.*)
RewriteRule /subdir/(.*) https://$1/secure/subdir/$2 [RP,I]

So using fiddler I can see that the request comes through for:

http://mysite.com/subdir/default.aspx

which gets redirected (301) correctly to

https://mysite.com/secure/subdir/default.aspx

but then after the secure connection is established it then get redirected (302) to

http://mysite.com/secure/subdir/default.aspx

and isn't in secure mode anymore (so this causes a 404 error). Note that even though it's not in secure anymore the "secure" subdir is still in the url.

Any idea why the url match happens again and why the https gets switched to non secure http?

Again, your help is really appreciated!
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 27 October 2010 at 8:25am

Please, use helpdesk or email to set up an online meeting. Please, mark letter with subj "To Andrushka".

Regards
Andrew
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version
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