So recently I had to implement 2 sets of sites using WordPress Mu (multi-user) and one of the requirements (for both sites) was to be able to domain map the sub-sites, much like you can do on WordPress.com for a fee. So I went about prototyping this and managed to get it working!
So I thought I would share my joy with a quick guide, because it was great to see it actually work!
What do you need…
<!–
document.write('’);
//–>
Requirements:
- WordPress Mu – if you dont know how to install it – check out Sarah Gooding’s great tutorial here
- Domain Mapping Plugin
- Access to the WordPress Mu install files on your hosting via FTP or File Manager (whatever,a s long as you can edit the code!)
- A hosting provider that is willing to make apache changes – critical to success – I had the privilege of working with RSAWEB on these projects but also confirmed with Serve Hosting that they can do it as well (although I havent tried it with them yet).
Just tell me how already!
- Install WordPress Mu
- Make sure Subdomains have been chosen as the blog option during install – needs wildcard DNS for this
- Download and extract the WordPress Domain Mapping Plugin
- Upload the sunrise.php file into your wp-content folder
- Upload the domain_mapping.php file into your wp-content/mu-plugins folder
- Now…edit your wp-config.php file in the document root of your site
- Find the line that says
define( 'SUNRISE', 'on' );
and uncomment it – add it if it isnt in the file - Dont forget to save your edited wp-config.php file
- Activate the Domain Mapping Plugin on the main WordPress Mu site backend
- Go to the Domain Mapping Plugin section in the main site backend
- Enter the IP for the main site in the Server IP Address field as example below
- If you dont know how to get the IP – you can ping the domain by going into the command prompt (if you’re working in windows) and type “ping mydomain.com”
- Now go to the sub blog backend that you want to domain map
- Activate the Domain Mapping Plugin
- Go to the Domain Mapping Plugin section in the sub blog backend
- Enter the domain that you want to map to the sub blog in the Add new domain field until it appears under the Active domains on this blog
- Now – you need to notify your hosting provider that they need to get Apache to catch the domain and point it at the same document root of the main site domain – ie the document root of your WordPress Mu install
- Usually this involves them doing one of 2 things – editing the vhost and/or editing the A records/CNAME records – they ‘should’ know what to do though
- Once the above has been done, all should be working great and you can view your sub blog at the new domain just like a regular WordPress site but on one code base!
Warning : Things can go pear shaped very quickly if you are not careful – the first time I did this I almost broke the entire install – not good if you are doing client work on a live site – don’t go editing database records; you can get it done that way but I don’t recommend it because your upgrading functionality becomes obsolete.
Leave a Reply