I have an example.org site where I save subsites as example.com/project1 and example.com/project2 and so on. I need a simple HTTPβHTTPS redirection only for some of the sub-sites, but I donβt need to write it in code files manually.
So, I found a URL-Rewrite2 and rules for it:
<rewrite> <rules> <rule name="Redirect to HTTPS" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="^OFF$" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" /> </rule> </rules> </rewrite>
It works with no more than one problem: it redirects from http://example.com/project1 to https://example.com/ , so it lost part of the sub-site URL and any arguments.
How can this be fixed?
UPD: this rule is used
<rule name="Redirect to HTTPS" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="^OFF$" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}{UNENCODED_URL}" /> </rule>
Subsite redirects normally, except that the arguments are duplicate. http://example.com/project1?page=2 turns into https://example.com/project1?page=2&page=2 . What am I doing wrong?
source share