Automatically make your web.config file force from HTTP to HTTPS for SSL Security.


I know this answer is out there in some form or fashion but I like to have it here for quicker access. This is the section of code that I use to force all of my websites to roll over to SSL in my web.config file.

I know this answer is out there in some form or fashion but I like to have it here for quicker access.


This is the section of code that I use to force all of my websites to roll over to SSL in my web.config file.


<system.webServer>
	<rewrite>
		<rules>
			<clear />
			<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>
Share On
rickthehat

Travel, Food, Vikings, Travel, Vood, Vikings, Travel, Food, Vikings, Travel, Food, Vikings & Einstok Beer from Iceland

Leave a Comment