Posts Tagged ‘permalink’

Improve Wordpress permalinks in IIS7

Tuesday, May 5th, 2009

Using Wordpress on a Windows Server with IIS7 causes the permalinks to have “index.php” in the url. An example would be “″, while this url is a valid link which will be spidered by search engines, it isn’t as esthetical as one would like.

Removing the “index.php” is rather straightforward, once you know how to. First you wan’t to add the following Web.Config to you virtual directory running the Wordpress blog. This will enable a rewriting rule in IIS7, which will rewrite every request that does not point to a physical file to “index.php”. Basicly transforming it to the way it previously worked.

<?xml version="1.0"?>
          <rule name="Main Rule" stopProcessing="true">
            <match url=".*" />
            <conditions logicalGrouping="MatchAll">
              <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
              <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <action type="Rewrite" url="index.php" />

Once we’ve added the config we can change the permalink structure in the admin pages of Wordpress. Choose your structure and remove the “index.php” prefix, be sure to leave a slash at the beginning of the desired structure.

// Change this:

// To this for instance: