Two things that needed doing – the first one was that I’m a windows guy, so my site is on windows and IIS. Apache has a nifty “mod_rewrite” add-on which lets WordPress do the cool url’s like http://blog.digitaltinder.net/2008/12/exporting-blogml-from-subtext-21-and-importing-blogml-into-wordpress-27/ instead of having a link to http://blog.digitaltinder.com/index.php?p=3746.
So I’d found a WordPress URL Rewriter which worked well (as long as PHP wasn’t running as an ISAPI module). But it needed me to add the url rewriter as an ISAPI module and I kinda wasn’t happy with having to make manual changes to my hosting setup because then upgrades/domain moves might cause issues. I wanted to have the solution I used only require me to change stuff in the plesk control panel, and not directly on the server.
With that limitation, I decided to go with the “fake 404” page solution which is mentioned in a few blogs. Basically this works because you tell IIS that if someone requests a page that doesn’t exist (like the pretty perma-link) then it should redirect the user to the index.php page with the correct settings in place so that wordpress shows the related blog entry. This works pretty well!
A basic sample of what I used can be found http://tech.einaregilsson.com/2007/07/30/pretty-wordpress-permalinks-on-iis/
So I decided to modify my little 404 page to include some redirects and I found the code below:
function redirect($url, $type=301)
if ($type == 301) header("HTTP/1.1 301 Moved Permanently");
echo ‘This page has moved to <a href="’.$url.’">’.$url.'</a>’;
And the proof is the fact that the blog should just be working at the moment, regardless of what URL you access it on. Of course that’s assuming that its all still working now, which probably thanks to the demo god’s will fail miserably now that I’m using it as an example.