0

我正在尝试使用 PHP5 (fastcgi) 在 IIS7 上为 Wordpress MU 2.7 配置重写规则。

目前我在 Web.config 中只有以下重写规则:

         <rule name="Canonical Host Name" stopProcessing="true">
             <match url="(.*)" />
             <conditions logicalGrouping="MatchAll">
                 <add input="{HTTP_HOST}" negate="true"
                      pattern="^subdomain\.example\.com$" />
             </conditions>
             <action type="Redirect"
                     url="http://subdomain.example.com/{R:1}"
                     redirectType="Permanent" />
         </rule>

在我输入 URL 的那一刻(见下文),它确实重定向到正确的主机名,但由于某种原因在路径前加上index.php/

url: `http://subdomain/my/path/123`
redirects to: `http://subdomain.example.com/index.php/my/path/123`
should redirect to: `http://subdomain.example.com/my/path/123`

有谁知道为什么会这样以及如何防止这种情况发生?

我是否缺少某个服务器设置或其他东西......?php.ini?web.config 规则?还是只是我的重写规则错了?

编辑:这个问题似乎与 Wordpress 的永久链接结构无关!如果我删除 redirect ,行为是相同的index.php。我认为没有任何 PHP 代码正在运行……这必须处于更高的级别。

4

2 回答 2

1

默认情况下(我认为),Wordpress 将友好的永久链接格式化为 index.php/path/to/post,因为这模拟了重写,而不需要服务器支持重写。这可以解释为什么你的重写是这样的——他们在重写之前有 index.php。

于 2009-05-08T16:25:12.533 回答
0

您可以通过更改WordPress 配置中的永久链接结构选项来防止它发生。

于 2009-05-08T19:15:19.300 回答