TechTalk

Topics in the world of web development and other technologies we find interesting.

WordPress Pretty Permalink Settings Results in 404 Error on Windows IIS

If you are enabling any of the alternate permalink settings in WordPress (located under Settings -> Permalinks) you may run into the common issue of seeing an ugly  404 - File or directory not found error when trying to view a post. Don't worry, windows IIS does support this ability, it just needs one extra step.

The Solution

According to the WordPress documentation, if you are running IIS 7+, you will need to also have the URL Rewrite 1.1+ module installed as well. This is a pretty standard module and is often already installed. 

What they don't mention however, is that you will need to enable this functionality in your web.config file. Look for this file in the root folder for your wordpress site, and if it does not yet exist, just create it (you can use notepad, but make sure to save the file as web.config, and not the typical .txt extension).

You will need to add the following content:

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

If you already had a web.config file, just add the tags that are missing, without deleting any of the existing settings.

Posted by Mark at 16:19
Tags :
Categories :
blog comments powered by Disqus

Authors

Recent Comments

Powered by Disqus Error loading MacroEngine script (file: uBlogsyListBlogRoll.cshtml)