Created
November 1, 2023 11:22
-
-
Save anova/2874cb8d0f7e19485b55bada9c27c273 to your computer and use it in GitHub Desktop.
web.config www and ssl enforce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<clear /> | |
<rule name="Redirect to www" stopProcessing="true"> | |
<match url=".*" /> | |
<conditions logicalGrouping="MatchAny"> | |
<add input="{HTTPS}" pattern="off" ignoreCase="true" /> | |
<add input="{HTTP_HOST}" pattern="^(?!www)" ignoreCase="true" /> | |
</conditions> | |
<action type="Redirect" url="https://www.{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" /> | |
</rule> | |
<rule name="Redirect to https" stopProcessing="true"> | |
<match url=".*" /> | |
<conditions> | |
<add input="{HTTPS}" pattern="off" ignoreCase="true" /> | |
</conditions> | |
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" /> | |
</rule> | |
</rules> | |
</rewrite> | |
</system.webServer> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment