Search code examples
phpwordpresswindowsconfigurationweb-config

issues in configuring WordPress website on a Windows server


I have moved my WordPress website to a Windows server, but I am facing an issue. If I place the code for this in web.config

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

then website gives an error 500.19 HTTP 500.19 Internal Server Error Config invalid

If I remove this code from web.config then website only works on permalinks that starts with index.php like index.php/opening-timings/


Solution

  • i suggest you to use as below but make sure that you have enabled rewrite rules module on IIS server because by default its on disabled stage.

    and you can also refer this link for configuring server wordpress Permalinks

    http://www.iis.net/learn/extensions/url-rewrite-module/enabling-pretty-permalinks-in-wordpress

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.webServer>
        <rewrite>
          <rules>
            <rule name="wordpress" 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" />
                </rule>
              </rules>
            </rewrite>
          </system.webServer>
        </configuration>