sun*_*esh 5 php asp.net web-config url-rewriting
我有一些文件需要在http.我尝试了以下代码,但不起作用.如何为web.config中的page1,page2设置强制HTTP
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Force HTTP" stopProcessing="true">
<match url="(.*)/page1.php" ignoreCase="false"/>
<match url="(.*)/page2.php" ignoreCase="false"/>
<conditions>
<add input="{HTTPS}" pattern="ON" ignoreCase="true"/>
</conditions>
<action type="Redirect" url="http://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我在IIS 7 Web服务器中工作,用于Windows中的PHP应用程序
您需要将规则更改为:
<rule name="Force HTTP" stopProcessing="true">
<match url="^page[12].php(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^ON$" />
</conditions>
<action type="Redirect" url="http://{HTTP_HOST}/{R:0}" redirectType="Permanent" />
</rule>
Run Code Online (Sandbox Code Playgroud)
将匹配任何以或url="^page[12].php(.*)"开头的 url 。
该操作将请求重定向到包含请求路径的位置。page1.phppage2.phphttps://{HTTP_HOST}/{R:0}{R:0}
| 归档时间: |
|
| 查看次数: |
633 次 |
| 最近记录: |