繁体   English   中英

从iis7中的wordpress URL中删除index.php

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

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