How to make WordPress permalinks work with IIS

By default WordPress and IIS do not play very nicely together as far as 'friendly' or 'pretty' permalinks go. This is primarily due to the absence of URL-rewriting features in versions of IIS prior to 7, and also partly due to WordPress being designed to work with the Apache web server rather than IIS.

When WordPress is initially installed on a Windows IIS server, and permalinks enabled, using those permalinks will generate 404 errors from the server rather than the expected pages. To solve this problem we recommend using a custom 404 handler to retrieve the URL information and pass it into the WordPress application. The page code should be as follows:

$pos = strrpos($qs, '://');
$pos = strpos($qs, '/', $pos + 4);
$_SERVER['REQUEST_URI'] = substr($qs, $pos);
  1. Create the file wp-404-handler.php in your base Wordpress folder using the code above.
  2. Submit a support request to have a custom 404 page set, indicating the name of the
  3. Go to Options -> Permalinks in your Wordpress admin page, and choose an appropriate structure for your links.
    • ie: /%year%/%monthnum%/%day%/%postname%/

Source: ©

Add Feedback