繁体   English   中英

防止IIS7重写将“ index.php”添加到重定向路径?

[英]Prevent IIS7 rewrite from adding “index.php” to path on redirect?

我正在尝试使用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的永久链接结构无关! 如果删除重定向index.php则行为相同。 我认为没有任何PHP代码正在运行...这必须处于更高的水平。

默认情况下(我认为),Wordpress会将友好的永久链接的格式设置为index.php / path / to / post,因为它模仿了重写而无需服务器支持重写。 那可以解释为什么您使用这种方式进行重写-在重写之前,它们中包含index.php。

您可以通过在WordPress配置中更改“永久链接”结构选项来防止发生这种情况。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM