[英]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.