iis web.config http跳转https配置

iis net 2.0经典模式下配置文件 配置好后 网址可自动跳转到https

<rewrite>标签的内容放入<system.webServer> 没有的话直接复制 <system.webServer>标签下所有内容到配置文件就行

1.http跳转对应网址的https

<configuration>
	<system.webServer>
		<rewrite>
			<rules>
				<rule name="Redirect to HTTPS" stopProcessing="true">
					<match url="(.*)" />
					<conditions>
						<add input="{HTTPS}" pattern="off" ignoreCase="true" />
					</conditions>
					<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
				</rule>
			</rules>
		</rewrite>
	</system.webServer>
</configuration>

2.http和https跳转到www网址

<rewrite>
			<rules>
				<rule name="WWW Redirect" stopProcessing="true">
					<match url=".*" />
					<conditions>
						<add input="{HTTP_HOST}" pattern="^s.wbsun.com$" />
					</conditions>
					<action type="Redirect" url="https://s.wbsun.com/{R:0}" redirectType="Permanent" />
				</rule>
			</rules>

 

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容