How to move site to a sub domain hosted on IIS – Tips and tricks

I have recently moved my free blog (the one that you are reading) to my own domain.

If you read the contents on this site I hope you think I am reasonably technically savvy, but the feat of moving my site and redirecting the links was problematic and it took me a few days and many wrong turns to get it done.

I found that most instructions are based on apache/linux hosted solutions and I had issues using my IIS/Windows based host. My windows based host uses Plesk 10 (@ the time of writing).

Before you even begin to touch a computer there are a few things you have to think of first!

1. Root site or sub-domain?

Is this the only thing that you will have on your domain or are you going to have something else hosted on You need to answer this now as when you go to buy your domain mapping from you can only map a whole domain. So you would be better off hosting it @, leaving the www for other things.

I started by creating my wordpress site with a click once install under a sub-directory in my httpdocs folder (main root web folder on my host), so I had my wordpress site setup @ but as you can’t register a sub directory I had to start again.

So in my case I went and created a new sub-domain,, and now I could register the sub-domain with my site.

2. Permalinks!!!!

Before you go any further you need to consider permalinks.

The issue by default uses links that are styled as “Pretty Links” and default to a format of /%year%/%monthnum%/%day%/%postname%/” which means a posts will appear as

The problem is that with version 3.2.1 of wordpress on a Windows host the “Pretty Link” is not supported by default and most “Permalinks” contain “index.php” in the path. see image..

Why is this a problem? Consider the link to your article that gets returned in a google search. When you try and do the domain mapping from to your domain, google will pass through a URL that your hosted wordpress site cannot handle.

This article discusses the various ways of mapping pretty links, and the section you are taken to is specifically for IIS/Windows systems.

My hosting provider already had a copy of Microsoft “URL Rewrite Module”, so I created a web.config file as per the suggestion in this article and applied it to my site but it would not work.

Assume the URL was

The URL re-writer would try to go to:

In the end I did a little bit of tweaking and came up with the following solution…


Put this is the root directory of your wordpress site.
<?xml version="1.0" encoding="UTF-8"?>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<action type="Rewrite" url="redirect.php?path={R:0}" />

If you look at the “Action Type” link this is re-writing the url to go to a page called “redirect.php” passing in a parameter of the relative path. So we now need to create the “redirect.php” page.


Again, create this file in the root of you wordpress site.

$relative_url = $_GET[‘path’];
$new_relative_url = ‘index.php/’. $relative_url;
$hostname = $_SERVER[‘SERVER_NAME’];
$new_url = ‘http://’ . $hostname . ‘/’ . $new_relative_url;

header("Location: " . $new_url)

So what is this doing?
The URL re-writer matches the invalid URL and re-writes the url to “redirect.php”. This page then takes in the parameter, and rebuilds the full url to the site based upon inserting “index.php” in the chain. This works and also the “referrer” and “search engine” stats are not affected by the extra redirect.

To test this take an existing post on your new site, remove the index.php and paste that into a new browser window. The site should redirect to the index.php version. This means any link to your site will redirect to your new domain and be successfully passed along to the index.php page.

The only problem with this is that I don’t see how you could reverse the process and return to your site. The new articles will be found with index.php and if you try to go back to as the primary domain the links with index.php will all break. Solution don’t go back. I will follow this up with wordpress and see if I can find a better solution.

Buy a domain from

Before you buy a domain read these wordpress articles about mapping domains or mapping sub-domains

Now seeing as I had created a sub-domain I went down the route of creating a CNAME entry. In plesk this means going to your DNSSettings and adding in a new CNAME. But being new to plesk I did not notice that when you make a DNS setting the settings shows with a warning like this
and right up on the top of the page you need to confirm the change by clicking Update.

So failing to notice that I handn’t saved the CNAME entry I gave up in frustration. So even though it told me not to I bought a domain and followed the full domain mapping instructions and it worked.

The instructions are fully mapped out in the mapping domains article but here are some extra tips.

  1. Go to your domain name provider site and find your name server settings, copy and paste them into a .txt document so you don’t forget them.
  2. With my name server provider, my names servers had a “Registrar Lock” on them. To update the,,, I had to
    1. Un-tick the checkbox and click save to clear the registrar lock.
    2. add the wordpress name servers and click save.
  3. now go to your site and go to Store –> Domains.
  4. enter your domain, and click Add, follow the process to purchase the domain mapping
  5. Once registered, select your domain as the “Primary Domain” and click “Update Primary domain”
  6. Return to your name server and enter in the previous name server settings that you backed up to the text file.
  7. Re-enable the “Registrar Lock” if you have one.

Your wordpress site should now all be working.

What Plugins?

Now you’ve been using for a while and you probably have it configured how you like it, so how do you make your new site just like
Most of the plugins on are special to, so I found it difficult to find and install the plugins to get the functionality I am used to.
So here is a mapping between functionality and the plugin you can freely download and install:

# Plugin Equivalent
1. Site Statistics Jetpack
2. Importer WordPress Imported
3. Ratings GD Star Rating

Other plugins I have found of interest;

  • Easy AdSense Lite
  • Google Analytics for WordPress
  • Preserve Code Formatting – keeps spaces and formatting when posting code snippets into your post.

Thats it for now.


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.