Now, this works fine - however, I need to exclude the page www.mysite.dk/nothttps/ from the rule so it will remain on http.
I've looked for at solution, of course, and I've found one that looked promissing but resulted in "too many redirects". That was to add this line after the first add-statement:
If you add that additional input to your https re-write rule.. you will need to change it from MatchAny to MatchAll else you create the conflict you are seeing.
Rewrite rules: Redirect to https except one url
Hi
I'm trying to get some redirect to work :)
I have a site, www.mysite.dk
I have a rewrite rule in place in web.config to redirect http to https, and it looks like this:
Now, this works fine - however, I need to exclude the page www.mysite.dk/nothttps/ from the rule so it will remain on http.
I've looked for at solution, of course, and I've found one that looked promissing but resulted in "too many redirects". That was to add this line after the first add-statement:
Obviously I'm doing it wrong, either in the input parameter or the pattern parameter - or both :D
Is there anyone who can tell me how to do it right? :)
Help would be much appreciated :)
Kind regards, Bruno
Hi Bruno,
If you add that additional input to your https re-write rule.. you will need to change it from MatchAny to MatchAll else you create the conflict you are seeing.
Nik
Hi Nik
Thanks :)
First hurdle overcome, it doesn't error with "too many redirects" :)
So now it looks like this:
I've tried with the pattern being ^/nothttps/$ then ^/nothttps/ and now ^nothttps/ and it still redirects http://www.mysite.dk/nothttps/ to https://www.mysite.dk/nothttps/
Anyone have an idea of what I'm doing wrong? :)
Kind regards, Bruno
EDIT: Also tried ^/nothttps$ still redirects
EDIT2:
Tried a different approach that still didn't work:
(and it didn't help either to change false to true for the stopProcessing parameter)
Hi Bruno,
Try this:
I've tested this on a local site and it appears to work (although I did have the domain hard coded instead of using HTTP_HOST in the redirect action.
Hi Nik
Sorry I didn't get back to you earlier. I actually found a solution just before you posted this. I needed to set ExactMatch:
Thank you for your time and effort :)
Kind regards, Bruno
Hi again
I was a bit quick to say I found the solution. Actually now no http to https redirects happen.
is working on a reply...