I’m developing a site that has been migrated live but now every page except for the home page 404s upon linking to it.

I’ve done extensive research on this and nothing has helped. Let me list out the things I’ve tried:

  1. I am running on a Windows server with IIS. So if it is a Permalinks structure problem, then a web.config file (mod_rewrite functionality) should fix the problem. But it doesn’t. The home page is still showing up as is and the other pages still 404.
  2. Switching the Permalinks to Default does solve the problem but it ruins the links that the client wants. So I can’t use this as a solution. Permalinks need to stay on “Post Name”.
  3. Extensive IIS research revealed that one possible solution might be ISAPI Rewrites. I downloaded a plugin for WordPress… ISAPI Rewriter. When I activated this plugin, the home page broke too. So I deactivated that plugin.
  4. The migration was done using All-In-One WP Migration which (as far as I can tell) did nearly nothing. The database may have been ported over. The content came over which was good. The theme looked good. But none of the hooks (of which there are quite a substantial amount) came over. Plus, the actual javascript files for the theme that had been modified were left un-modified on the new site. So large portions of the home page (and by extension every other page) are non-functional. As I understand it, after using All-In-One WP Migration, to solve the Permalinks problem, you need to save your Permalinks settings twice. I did. The error persists. All pages but the home page still 404.
  5. I contacted the developer of All-In-One WP Migration and they were rolling out an experimental new version… I’m just going to stop there. The problem persists. All pages 404.
  6. I’ve found threads and pages both on Microsoft sites and the WordPress Codex about how to solve this problem including updating the web.config file with code straight from the WordPress Codex. All to no avail.
  7. Before you tell me there’s a million questions like this on this site, I’ve looked at nearly all of them. No help.

So has someone actually solved this problem on IIS? Can anybody shed some light on this or point me in a new direction?

The code for my web.config file is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <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>

These settings worked on another site on IIS on a similar server here but not on the one I am working on now. WordPress recommends this code instead:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WordPress Rule" stopProcessing="true"> //notice a change here
<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?page_id={R:0}" /> //notice a change here
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

I’ve tried this too without success. Any other ideas?

Read more here: WordPress Site Pages 404ing - Help with Permalinks on IIS?


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: