Configuring Wordpress 3 with Multisite and second-level domains

Wordpress Multisite

I would like to test if it works to serve more websites from one Wordpress installation. By default Wordpress supports subdomains (like Wordpress.com) but I would like to run the installation with second-level domains (SLD). This is described in this article. Maybe in the future Wordpress will support SLD, in that case I will report that in this article.

Why this article?

Yes, I know there are a lot of other howto’s about to install Wordpress Multisite. I did not find a correct one and it confused me. To install Wordpress Multisite for SLD is not complex, it is robust, but there are some tricky things that you need to know. That is why I wrote this article. Ok, let’s start!

Mandatory preparations

Install Wordpress

If you not already installed, you can do a default installation on your domain. No special things at all. Since Wordpress 3.0, multisite is integrated in the regular version of Wordpress.

DNS configuration

The DNS needs to be enable for wildcards before your domain name. Currently I like to test it on my local machine. The complete configuration for DNS and WAMP locally is described here: Adding wildcard domains dns to local WAMP How to configure this on your live webserver depends on your provider. Please ask them for this.

Apache

All the domains you are going to use, needs to point to the same directory. You can find an example here: Adding wildcard domains dns to local WAMP

Enable Multisite

Login into your admin page of your site. To enable Multisite in Wordpress you need to add the following line to wp-config.php:

define('WP_ALLOW_MULTISITE', true);

Now press F5 in your browser to refresh your admin page. Go to new menu  Tools->Network Setup and leave the settings by default. We need Sub-domains and this is selected. Press Install

Now perform the suggested three steps:

  1. Create the blogs.dir in wp-content
  2. Add the lines to wp-config.php
  3. Add the lines to .htaccess

Again press F5 in your browser. You can have the message that you are leaving this page, ignore it. Now you need to login again, you are now Network Admin!

Installing Domain mapping

To add the missing functions to map SLD domains, we are using the plugin WordPress MU Domain Mapping. Go to the plugins menu and add the plugin: WordPress MU Domain Mapping Then you need to click on Network activate

After that you need to copy sunrise.php from the directory: wp-content\plugins\wordpress-mu-domain-mapping to the wp-content directory.

To finish the plugin installation you need to add the following line to wp-config.php:

define( 'SUNRISE', 'on' );

Configure the Domain Mapping

Go to menu: Settings->Domain mapping.

In the field Server IP Address, fill in the IP nr of the server. In my case for the test is this: 127.0.0.1

Select the Domain Options:

  • Remote Login
  • Permanent redirect (better for your blogger’s pagerank)
  • User domain mapping page
  • Redirect administration pages to site’s original domain (remote login disabled if this redirect is disabled)

And deselect the Domain Option:

  • Disable primary domain check. Sites will not redirect to one domain name. May cause duplicate content issues.

Press the button Save

Add the other domain(s)

Go to menu: Sites->Add New

Because Wordpress Multisite supports only subdomains, this page is like we are adding a subdomain. Fill in the fields:

  • Site Address: a part of the domain name: otherdomain (instead of otherdomain.com)
  • Site Title: the title of your site
  • Admin email: the email address of the admin

Press the button Add Site

Now click in this page Edit site

  • Modify Domain to your final domain name: otherdomain.com

Press the button Save Changes

Click on the tab Settings, and search for Fileupload:

  • Modify the url in Fileupload Url to your final domain name

Press the button Save Changes

Site ID

For the Domain settings we need to now which Site ID every site has. Normally it starts with 2 and further, but you can check this by doing the following.

  • Go to menu: Site->All Sites & Hoover or click on Edit of the new added site(s).
  • You can find the Site ID in the URL: otherdomain.com/wp-admin/network/site-info.php?id=2

Domain Mapping: Domains

Go to menu: Settings->Domains

  • Site ID: fill in the Site ID you just found, corresponding to this domain
  • Domain: Fill in your final domain name (example: otherdomain.com)
  • Primary: Checked for the primary domain. For otherdomain.com it is checked, but not for www.otherdomain.com. www.otherdomain.com will be redirected to otherdomain.com

Press the button Save

Now you are able to access the site and the admin pages of the added domain.

Remark

Sunrise.php

On a Linux machine I should see make a symbolic link, but for Windows is that not the case. Because when updating the plugin, the sunrise.php file needs to be updated by copy the file again.