[英]Remove index.php from wordpress URLs in iis7
我想從url中刪除index.php,我正在使用wordpress和iis7。 我怎樣才能做到這一點
使用此web.config
(web.config是IIS等同於apache webservers中的.htaccess文件。它可以在根文件夾中找到。如果沒有,則需要創建一個。)
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<!-- Set the default document -->
<files>
<remove value="index.php" />
<add value="index.php" />
</files>
</defaultDocument>
<httpErrors errorMode="Detailed"/>
<rewrite>
<rules>
<rule name="wordpress" patternSyntax="Wildcard">
<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" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
然后在永久鏈接頁面中,設置“自定義結構”並給出值/%postname%/
請注意, 需要安裝特定於IIS版本的URL重寫模塊才能使其正常工作(感謝@ Spikolynn的評論如下)
在您使用Windows Azure網站的情況下,另一個非常快速的解決方案是使用Microsoft WebMatrix
登錄您的網站,只需創建一個web.config文件, 如本文所述 。 這解決了它。 無需自己安裝URL Rewrite extension
或類似的東西。 MS Webmatrix似乎很容易解決問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.