Published on: 07 Apr, 2021

How to redirect HTTP to HTTPS using URL Rewriter in IIS?

Tumblr Digg Google Plus

If you need to automatically redirect HTTP to HTTPS in IIS. You can use the help of the URL Rewriter plugin in IIS.

In your .Net web config file under the root folder of your site application. There is a section under system.webServer, you can pass the following rule code.

<system.webServer>
	<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}{UNENCODED_URL}" appendQueryString="false" />
			</rule>
		</rules>
	</rewrite>
</system.webServer>

Comments

There are no comments available.

Write Comment
0 characters entered. Maximum characters allowed are 1000 characters.