How to Set Up Pretty Permalinks in a Windows Environment Running IIS 7.x

WordPress > How To

 

How to Set Up Pretty Permalinks in a Windows Environment Running IIS 7.x

This article will help you to set up Pretty Permalinks for your WordPress site if you are unfamiliar with the Windows hosting environment, and IIS rewrite rules.

  1. Log in to your site. For example http://yourdomainname.com/wp-login.php.
  2. Click on Settings > Permalinks.
  3. In the Common Settings section select the type of permalink structure you would like to use.
  4. After selecting the version you would like to use, remove the /index.php from the beginning of the permalink structure, for example, instead of /index.php/%postname%/ you would only need /%postname%/.
  5. Click Save Changes. Your site will not totally work until you perform the next steps.
  6. Open up an FTP connection to your site, and in the root of your site, you should see a web.config file.
  7. The web.config file is the IIS equivalent of a .htaccess file. It will contain allow, deny, and rewrite rules.
  8. This file can be opened using a simple text editor such as Notepad on Windows or TextEdit on a Mac. You can also use your favorite text editing program of choice.
  9. If this file does not exist in the root of your site, you can create it with the same program and give it an extension of .config
  10. In this file, you will need to add the following code:
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <rule name="WordPress Rule" stopProcessing="true">
                        <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>
  11. Save the file, and upload it to the root of your site using FTP.
  12. Load your site, and try a few of the pages. If all is working as expected, your links will match the structure string that you chose for your permalinks. For example, if you chose /%postname%/ then a page named Sample will show up as http://yourdomainname.com/sample/

Add Feedback