Lions Den

The Code and Times of Hanan Schwartzberg

About Hanan | Hanan's CV | Contact Hanan

January 23, 2015

WordPress blog on Windows not found

Filed under: IIS7,IIS8 — Tags: , , , — Hanan Schwartzberg @ 6:49 am

The Issue

When migrating an existing WordPress blog, instead of creating a new one, the admin section of the blog works fine, but the front-end throws a 404 error.

The Solution

First step is to make sure everything is setup correctly. Japinator has an excellent step by step explanation of how to Create a WordPress blog on Windows Server 2008 R2, IIS 7.5 and MySQL. The tutorial is written for Windows 2008 and IIS7, but it works just as well with Windows 2012 and IIS8.

Once everything is setup correctly, if it’s an existing blog from a Linux environment, the problem will still persist.

Amrit Ray has a WordPress on Windows – Issues & Solutions. He explains that you need to use the Url Rerwiting module for IIS, available here http://www.iis.net/downloads/microsoft/url-rewrite because Linux creates the .htaccess file with the required permalink settings automatically, but in Windows you have to set it up manually.

To do this, after the Url Rewrite module is installed add the following web.config file to folder containing the WordPress blog.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <defaultDocument>
      <files>
        <clear/>
        <add value="Default.htm"/>
        <add value="Default.asp"/>
        <add value="index.htm"/>
        <add value="index.html"/>
        <add value="iisstart.htm"/>
        <add value="default.aspx"/>
        <add value="index.php"/>
      </files>
    </defaultDocument>
    <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>

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Anti-Spam by WP-SpamShield

Home | Site Design | Banner Design | Code Den | Offsite Posts | Downloads | Photography | About Hanan | Hanan's CV | Contact Hanan
Copyright © 2009 Hanan Schwartzberg. All rights reserved.