IMG-LOGO

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

andy - 07 Apr, 2021 2630 Views 0 Comment

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.

Related Articles

Getting HTTP Error 500.21 - Internal Server Error

When you try to run MVC site or ASP Net framework 4 website if you receive the following error HTTP Error 500 21 Internal Server Error Saying Handler ExtensionlessUrlHandler Integrated 4 0 has a bad module ManagedPipelineHandler in its module ...

How to allow loading and downloading json file in IIS?

In order to allow loading and downloading json file on your site you have to add json extension in mime type and handler mappings in IIS windows server By default this extension is not view able Therefore you will need ...