Support » Fixing WordPress » Removing Index.php in Permalinks using IIS 8

  • Resolved justistar

    (@justistar)


    Hi Everyone,

    So I’ve been spending the better part of the day to figure out a way to remove “/index.php” from my permalinks.

    I’m using discountasp.net, so it’s a Windows server. I don’t prefer this, but for the person I’m making the site for, it’s necessary.

    So far, I’ve found a solution changing my web.config file to:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.webServer>
        <rewrite>
          <rules>
            <rule name="WPurls" enabled="true" stopProcessing="true">
              <match url=".*" />
              <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
              </conditions>
              <action type="Rewrite" url="index.php/{R:0}" />
            </rule>
          </rules>
        </rewrite>
      </system.webServer>
    </configuration>

    This works to remove /index.php from my permalinks on pages, but what happens now is my homepage needs to have /index.php at the end, otherwise it just shows a directory listing.

    Any help would be really appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You simply need to tell the server that the default page for your site is index.php.

    change your web.config to:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <defaultDocument enabled="true">
                <files>
                    <add value="index.php" />
                </files>
            </defaultDocument>
            <rewrite>
                <rules>
                    <rule name="WPurls" enabled="true" stopProcessing="true">
                        <match url=".*" />
                        <conditions logicalGrouping="MatchAll">
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="index.php/{R:0}" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>

    @tiaanswart THAT WORKED PERFECTLY!

    Thank You so much!!!

    When I do that and change the permalinks to custom I get a 404? Windows Server 2003/IIS 7

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Removing Index.php in Permalinks using IIS 8’ is closed to new replies.