WordPress MU, or just WordPress now as of v3, supports “networks” of sites. Once you set up the main site, you can install other sites into folders, or on to subdomains of the main domain. There is a lot of information on the subject, and my friend Nick Boldison wrote a blog post here – WordPress: How to enable multi-site in WP3.
A couple of things have changed in WP3.1, such as the Super Admin now being called “Network Admin” and being located in the top right corner.
It’s a great guide and quickly gets you up and running with a quick blog network all in folders or subdomains and I can’t improve on it.
What I did want to talk about though was getting your blog network running on multiple IPs and more importantly, multiple domains. I didn’t think this was possible. After all, WordPress says, subdomains or folders. Those are the only two options. However, enter the WordPress MU Domain Mapping plugin.
Once you’ve installed the plugin, you’re pretty much set. Just add a line to the config:
1 |
define( 'SUNRISE', 'on' ); |
and make sure you copy the sunrise.php file into the root of wp-content from your plugins folder.
Once you add a new subdomain / folder you can access the dashboard of the site and add a domain mapping, such as this example from an internal network (it was easier to configure the multiple IPs on our linux box and domain controller):
Now that you’ve added the domain mapping, you can continue to add more and more sites following the same system. This means that you manage all of them from one central place but they can appear on different domains on different IPs.
As far as your linux set up to achieve this goes, just make sure that all the IPs and sites all point to the same folder, like this:
1 2 3 4 5 6 7 |
<virtualhost *:80> DocumentRoot "/var/www/somesite/" ServerName maindomain.co.uk ServerAlias *.maindomain.co.uk ServerAlias somecooldomain.com www.somecooldomain.com ServerAlias anotherawesomedomain.com www.anotherawesomedomain.com </virtualhost> |
In the example above, Apache has a virtual host listening on all IPs on the server. All are then routed through to the same document root if it matches one of the domains. This means you can just point your domain’s A record at an IP on the server and it should work. If you’re using a control panel for your server, you might have a little more work to do to set this up. CPanel has a nifty trick whereby you can alter the vhost.conf and then run
1 2 |
/usr/local/cpanel/bin/apache_conf_distiller --update /usr/local/cpanel/bin/build_apache_conf |
So, you can change the Virtualhost definition and then add the additional domains as parked domains on the primary one through the control panel you’re already used to.
Depending on your server setup, openbase_dir shouldn’t catch you out, but in case it does, you can disable this as part of your config file too.
Image Credit: thatcanadiangirl
Comment or tweet @douglasradburn