php – 如何对web.config文件中的某些文件强制使用http
发布时间:2020-05-31 01:02:07 所属栏目:PHP 来源:互联网
导读:我有一些文件需要在http.我尝试了以下代码,但不起作用. 如何为web.config中的page1,page2设置强制HTTP ?xml version=1.0 encoding=utf-8?configuration system.webServer rewrite rules rule name=For
|
我有一些文件需要在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>
我在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>
url =“^ page [12] .php(.*)”将匹配以page1.php或page2.php开头的任何url.该操作将请求重定向到https:// {HTTP_HOST} / {R:0},其中{R:0}包含所请求的路径. (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
