You are here:
The iPhone 4 ... The latest device from Apple The iPhone 4 ... The latest device from Apple

WordPress IIS permalinks using 404 redirect

Ok, I finally got a Wordpress blog to have Search Engine friendly URL's on a Windows 2003 server! I done a lot of searching and digging, but finally found this technique on Einar Egilsson's Blog. The solution uses a custom 404 handler to complete the redirecting. Simply by adding this custom 404 page, your blog can be transformed into a search engine friendly haven of links. The steps are as follows ... (once again compliments to Einar Egilsson)

Step 1: - Create a file called wp-404-handler.php. Inside the file, put the following code:

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

Step 2: - Put this file into your blog web root

Step 3: - Update your 404 handler to point to your new wp-404-handler.php file.

Step 4: - Setup permalinks in your WordPress Admin and put the following custom URL pattern

/%year%/%monthnum%/%day%/%postname%/

Save your settings and Voila!! a new blog with lovely looking links!