• Resolved paulinhapenedo

    (@paulinhapenedo)


    Hello guys!

    I’m using a Windows host with IIS 7 and PHP 5 enabled for a website. It took me a while to get used to work with web.config instead of .htaccess, but there’s still on problem that I can’t solve.

    I managed to remove the index.php from my url using this web.config file, but my home page is giving me a 404 error.

    http://wmf.mus.br = 404 error
    http://wmf.mus.br/index.php = brings home page.

    I’ve tried almost everything that Google searchs suggested, but none worked.

    Help, please?
    Thanks!

    Web.config file

    <configuration>
      <system.webServer>
         <rewrite>
          <rules>
            <!-- Se possuir mais de um blog no servidor, mude a "name" da linha abaixo para um nome qualquer -->
            <rule name="wordpress" stopProcessing="true">
              <match url="^(.*)" />
                <conditions>
                  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                  <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    	      <add input="{HTTP_HOST}" pattern="^(www.)?wmf\.mus.br" ignoreCase="true" />
                </conditions>
              <action type="Rewrite" url="index.php" />
            </rule>
          </rules>
        </rewrite>
      </system.webServer>
    </configuration>

Viewing 2 replies - 1 through 2 (of 2 total)
  • try this code

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

    After that you will go to dashboard – general settings – permalink. Select the custom and put /%postname%/ and save permalink. Now check once the site.

    Thread Starter paulinhapenedo

    (@paulinhapenedo)

    Thanks, @wprock. It worked like a charm.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Home page getting a 404 error’ is closed to new replies.