【发布时间】:2018-01-26 20:03:12
【问题描述】:
我的笔记本电脑(Win 10 Pro)上有一个在 IIS 10 中运行的 PHP 网站。
本网站使用重写规则并且在本地工作。
url mylaptop:8181/login 很好地重写为 mylaptop:8181/index.php?url=login
我将此网站放在运行 IIS 8.5 (Win Server 2012 R2) 的测试服务器上。
我的重写规则不再起作用。它将 URL testserver:207/login 重写为 testserver:207//testserver:207/login。显然这里出了点问题。
这是我的 web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="RedirectUserFriendlyURL1" stopProcessing="true">
<match url="^index\.php$" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
<add input="{QUERY_STRING}" pattern="^url=([^=&]+)$" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="false" />
</rule>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?url={R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
我希望有人能指出我正确的方向!
【问题讨论】:
标签: php iis url-rewriting