|Posted: 22 October 2010 at 2:52am
I'm struggling trying to get a rewrite working. I need helicon to grab a URL like this:
http://dev.mysite.net/subdir/default.aspxand redirect it to
https://dev.mysite.net/secure/subdir/default.aspxfor 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.
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!