We’d like to get more technical posts on this blog, mainly to remind ourselves of things we’re likely to forget, but also to help our users as well… So when we were asked to do some testing for a solution today we thought we’d start with this….
Many of our users are familiar with WordPress, we use it both as a blogging platform and a content management system for our users to allow them to update their own websites with no technical knowledge. Our designer is a WordPress theme specialist and can make a WordPress installation look very different (contact us for details)!
WordPress MU was a separate project to the main WordPress code for a while, but since version 3 has been migrated into the main core of WordPress.
The Problem: WordPress supports multiple blogs from one code installation of WordPress in different folders or subdomains, what is needed here is to create WordPress blogs on multiple subdomains of different domains (e.g. maindomain.com, blog1.maindomain.com, blog2.anotherdomain.com, blog3.yetanotherdomain.com).
The Solution: We’re not going to re-invent the wheel here, so where possible we’ll link to relevant tutorials for these steps, also note that we’d advise not visiting the subdomains you want to view until you get to the end of the tutorial – cached DNS causes all sorts of confusion!
- Install WordPress (If you’re one of our customers you can install it from within the Fantastico section of the control panel, if you’re not then download and install it from here).
- Ensure you are running the latest version by logging into your WordPress Admin and checking for any updates.
Lets take a moment to setup the DNS next as this can take a while to settle down…
- Login into your hosting control panel and go to parked domains, in here you’ll need to park all of the domains that you want blogs to appear at, park them to point directly to your /public_html directory with no redirection.
So in the case of our example we’ve pointed the nameservers for all of our domains to our main hosting account (maindomain.com), and then parked anotherdomain.com and yetanotherdomain.com on top of that so that when we visit anotherdomain.com and yetanotherdomain.com we end up in the same place – your WordPress installation.
- Next we need to setup wildcard subdomains, this is so that blog1.maindomain.com and blog2.maindomain.com will work and is normal for a WordPress Multi-Site installation, however we need to do it for all of the domain names we want.
Go to subdomains in your hosting control panel and you should find that all of your parked domains appear in the drop down box. Enter an asterisk (*) in the first box and public_html in the third box then click create, repeat this for all of the domains in the drop down.
- We’re now ready to make WordPress work Multi-Site within Subdomains, follow the WordPress Create A Network tutorial, starting at Step 3.
– Step 3: Allow Multisite
– Step 4: Installing a Network (choose Sub-domains).
– Step 5: Enabling the Network
- You can stop at this stage, if you simply want to run blogs on subdomains e.g. blog1.maindomain.com, blog2.maindomain.com. You can start configuring these in the Super Admin section of the WordPress Dashboard.
- However, if you want to run multiple domains, you’ll need the following plugin:
WordPress MU Domain Mapping
It is not possible to do an automatic install of this plugin as it has files that need putting in different places, so be sure to follow the WordPress MU Domain Mapping Installation Instructions, steps 1 to 4.
- Create a new site, for either the main domains subdomain, or the subdomain of one of your parked domains:
- You’ll notice that once you’ve added it, it has no “Mapping” on the right hand side of the table. This mains that blog2.maindomain.com would work, but blog2.anotherdomain.com would not, and is what the plugin we’ve installed is there to correct.
- Click on Domain Mapping in Super Admin and insert the IP address of your server in the Server IP Address before clicking Save.
- Click on Domains in Super Admin and enter the site ID for the site we just created, along with the Domain name/subdomain we want to attach to that domain.
At this point, your domains will redirect correctly to the parked subdomain, in our example going to blog2.anotherdomain.com would deliver you to blog2.maindomain.com.
- Next click on sites, and edit the site that you’re working with.
Change the “Domain” field to be the correct domain for that particular subdomain (In our case blog2.anotherdomain.com).
- Now blog2.anotherdomain.com should work, repeat steps 8 to 12 all of your other subdomains/domains.
If you’d like us to set this up for you, contact us for a quote!