Final bits of WordPress migration

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 instead of having a link to

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!

The final bit of my wordpress migration was that my old site had it at, while the new site is at (or

A basic sample of what I used can be found

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");
  header("Location: $url");
  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.

Leave a Reply

Your email address will not be published. Required fields are marked *