26 November 2011

WordPress Multisite Domain Mapping - ISPConfig 3

I'm going to assume you're familiar with setting up and installing WordPress and installing plugins and have an intermediate knowledge of hosting and domains.
This isn't a tutorial, more of a checklist, but if you have any questions then please ask in the comments below.

If you're setting up a WordPress multisite network on your server with ISPConfig 3 control panel, the workflow is mostly the same as the tutorials you can find by searching with your favourite search engine. There are, however, two important things to get right (highlighted red) that if not correct will result in endless redirect loops.  The 'Aliasdomain' section isn't covered in any tutorials I could find, but this slots in where the official tutorial talks about 'parking' names in cPanel (a more popular control panel solution).

Example Site: example.com, blog2.example.com, example.org
Example IP: 217.145.318.277
(Replace with your own details- IP address is impossible anyway!)

Set up domain in ISPConfig:
Set up DNS details making sure you have A records for 'www', '*' and ' ' (i.e. blank) all pointing to the server's primary IP address
-- So www.example.com, example.com and everythingelse.example.com at the moment all point to your index.html page on example.com
Set up a site for your primary domain (where you'll install WordPress).

Installing WordPress & Plugins:
Install WordPress (I'm using 3.2.1). Set up your primary blog on example.com
Follow instructions for setting up a multisite network.
Install and activate the plugin Wordpress MU Domain Mapping.
Install and activate the plugin Better HTTP redirects.

Mapping Domains:
Create your secondary blog e.g. 'Blog2' which is now at the address blog2.example.com.
From the Settings menu, choose 'Domain Mapping'.  If you were hosting your WordPress install on your server's default domain, you could put the IP in and omit CNAME, but as we're installing on a server that we're sharing with many domains, ignore IP and in CNAME enter the main blog domain i.e. example.com
In 'Domain Options' on the mapping page, select options 1, 2, and 4.
Next choose the option 'Domains' from the Settings menu.  In 'Site ID' enter '2' (assuming this is a fresh install and the first sub-blog you've set up, else find your ID from the 'Sites' menu) and in domain enter example.org. IT IS VERY IMPORTANT THAT DOMAIN IS ALL IN LOWERCASE! Tick/check the 'Primary Domain' option and click save.

Setting Up Secondary Domain:
At your registrar, find where you can edit your DNS settings.
Remove any A records for ' ' (i.e. blank) - sometimes represented as '@', '*' and 'www'.
In their place create CNAME records for each of the above, pointing at 'example.com'.

Alternatively, if your name servers already point at your ISPConfig server, you can create the domain name under 'DNS' and change the settings on the ISPConfig server as outlined above.

Alias To Main Site
In your ISPConfig control panel, select the 'Sites' menu option, and then the 'Aliasdomain for website' from the left-hand menu.
Choose to 'Add new alias domain'.
In 'Domain' enter example.org
For 'Parent Website' select example.com from the drop-down menu.
For 'Redirect Type' select 'No Flag' from the drop-down menu.
Leave 'Redirect Path' blank, and for 'Auto Subdomain' select '*.' from the drop-down menu and make sure 'Active' is ticked/checked.

Sometimes, DNS settings take a while to work, so I would suggest taking this opportunity to make some tea/coffee.

Now, visiting example.com should take you to your primary blog, example.org should take you to Blog2 and if anyone entered blog2.example.com, they should get redirected to example.org (which should display in the address bar).  All sites can be managed from the 'Network Admin' page which you can reach from the WordPress dashboard (at 3.2.1 this is where it says 'Howdy, Yourname", but this will be slightly different in 3.3).

Update [Feb 2014]: +Gwyneth Llewelyn has posted a helpful comment containing a method for nginx users to utilise the benefits of W3 Total Cache: https://plus.google.com/117667414309209066991/posts/SsWV8EXds5c
She also points out that the 'Better HTTP redirects' plugin is no longer maintained (I've just realised this post is over two years old!) and may not be required. I deactivated on one of the few WP Multisite installs I have remaining and there seems to be no adverse effects. (YMMV).

3 comments:

  1. Thank you for your detailed accounting... I wasn't clear on the need, nor specifics, surrounding configuring the the alias domain entry in the ISPConfig3 backend, until you exposed the solution.

    One area that I stumbled through, however, was the secondary domain DNS configuration. The secondary domain I was configuring has GoDaddy.com as the Registrar. GoDaddy's DNS Manager prohibits using @, ' ' & * entries as CNAME records. I found that I needed to have the two A Records configured, however, for @.example.org, and *.example.org. I set these records to point to the server's IP address. I also found that mapping the www CNAME record to blog2.example.com (rather than example.com), was another important piece of the puzzle.

    Once the DNS records were configured in this way, the alias domain configuration you outlined, was the next & final component. While setting the example.org domain to point to example.com seems pretty clear, I don't fully understand the redirect-type configuration of "No flag".

    Can you please explain how this "No flag" setting works to influence the correct redirect behavior? Many thanks for your thoughtful & well prepared exploration!

    ReplyDelete
  2. Harrah's Cherokee Casino & Hotel - MapYRO
    Find goyangfc your way around the casino, 바카라사이트 find where everything is located ventureberg.com/ with the most up-to-date information about Harrah's Cherokee Casino & หารายได้เสริม Hotel in 출장마사지 Cherokee, NC.

    ReplyDelete
  3. The casino features 1xbet korea stay casino video games, along with all the favourites like slots, bingo, carps, etc. The casino’s promotions page often lists all the necessities want to|you should|you have to} meet for every promotion. If you continue to} can not find the wagering necessities for the welcome bonus, guidance of} the phrases and circumstances or contact their customer help. Hard Rock Casino Online has an enormous first deposit match bonus. They match your first deposit one hundred pc as much as} $1,000 in bonus money.

    ReplyDelete