Ich habe einige Website example.org
, auf denen ich Unterwebsites wie example.com/project1
und example.com/project2
und so weiter. Ich brauche einfach HTTP→HTTPS
Redirect auf einigen Unterwebsites, aber möchte nicht in Codefiles manuell schreiben.IIS URL-Rewrite: HTTP zu HTTPS
So fand ich URL-Rewrite2
Modul und Regel für ihn:
<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>
Es höchstens mit einem Problem arbeitet: es leitet http://example.com/project1
-https://example.com/
, so dass es Subsite URL Teil und alle args verloren.
Wie kann das behoben werden?
UPD: verwendet diese Regel
<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 normalerweise leitet, außer dass Argumente dupliziert. http://example.com/project1?page=2
wird zu https://example.com/project1?page=2&page=2
. Was mache ich falsch?