Uses for redirect

In most cases a redirect is used for one of two reasons:

  1. Redirecting the user from http to https to enforce SSL communication. When a webserver is load balanced this is typically done using the load balancer but it some cases can be done on the webserver or another server running IIS by using the IIS URL Rewrite module
  2. Redirecting a user who has a stale URL, typically when the name is changed during a farm migration or upgrade. This can also be done using a load balancer or any IIS server by implementing the URL Rewrite module.
<rewrite>
	<rules>
		<rule name="Redirect to http" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
			<match url="*" negate="false" />
			<conditions logicalGrouping="MatchAny">
				<add input="{HTTPS}" pattern="off" />
			</conditions>
			<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Found" />
		</rule>
	</rules>
</rewrite>
or
<rewrite>
<rules>
<rule name="HTTP/S to HTTPS Redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{SERVER_PORT_SECURE}" pattern="^0$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>

Article ID: 1138, Created On: 2/12/2018, Modified: 2/12/2018

Feedback (0)