其他网站相关知识您现在的位置是:主页 > 其他网站相关知识 >

IIS伪静态规则web.config让http自动跳转到https

2023-01-09 13:53:05其他网站相关知识 36人已围观

web.config代码如下

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
	<system.webServer>
        <rewrite>
            <rules>
				<rule name="301" stopProcessing="true">
					<match url="^(.*)$" ignoreCase="false" ></match>
					<conditions logicalGrouping="MatchAll">                       
					<add input="{HTTP_FROM_HTTPS}" pattern="^on$" negate="true" ></add>  
					</conditions>
					<action type="Redirect" url="https://www.baidu.com/{R:1}" redirectType="Permanent" ></action>
				</rule>
			</rules>
		</rewrite>
	</system.webServer> 
</configuration>