繁体   English   中英

如何从IIS Windows服务器URL中删除Index.php

[英]how to remove Index.php from iis windows server urls

首次使用IIS服务器。 在服务器上安装了wordpress。 问题是没有url中没有index.php的网站无法正常工作。

stackoverflow尝试这个。 执行此操作后,将显示错误500。 我的webconfig文件是

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <defaultDocument enabled="true">
      <files>
        <clear />
        <add value="index.aspx" />
        <add value="index.asp" />
        <add value="index.htm" />
                 <add value="index.php" />
        <add value="index.html" />
        <add value="home.aspx" />
        <add value="home.asp" />
        <add value="home.htm" />
        <add value="home.html" />
        <add value="default.aspx" />
        <add value="default.asp" />
        <add value="default.htm" />
        <add value="default.html" />
      </files>
    </defaultDocument>
 <directoryBrowse enabled="true" />
  </system.webServer>
</configuration> 

也试图与此改变

<?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>

尝试在您的web.config上使用它。

<?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.web>
        <customErrors mode="Off" />
        <compilation debug="true" />
    </system.web>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{R:1}" pattern="\.(gif|jpe?g|png)$" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/index.php/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    <security>
            <requestFiltering allowDoubleEscaping="true" />
     </security>
    </system.webServer>
</configuration>

暂无
暂无

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

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