shepline creative

Setting permalinks in WordPress

For my sins, I use a webhost which works on Windows servers. For the most part, it makes not a jot of difference to me but does cause a few headaches when setting up sites using a wordpress install at the base of it. In particular setting nice pretty permalinks when I don’t have access to IIS mod rewrite rules…

I did manage it on this very site eventually, but it wasn’t straight forward particularly as I needed a separate 404 redirect for the subdomain (which I didn’t have access to). Setting up the new BVToday.net website is more straight forward, but I thought I would post the solution here, partly for my own future benefit:

Requirements and Install instructions:

  • IIS for Windows
  • WordPress
  • Ability to change your 404 error page with your web host.

To install, copy and paste this text into a file named wp-404-handler.php:

<?php
$qs = $_SERVER['QUERY_STRING'];
$_SERVER['REQUEST_URI'] = substr($qs, strpos($qs, ':80')+3);
$_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'];
include('index.php');
?>

Next set the 404 error page to /wp-404-handler.php. If it gives you a choice between file and url, choose url.

Lastly, make sure you enable permalinks in the WordPress control panel under Options > Permalinks.

This solution supercedes the ASP solution.

Category: development, tips'n'tricks

Tagged: ,

One Response

  1. Thomas says:

    Custom settings: /%year%/%monthnum%/%day%/%postname%/

Leave a Reply