wiki:how-to/wordpress/network

Version 1 (modified by Jesus Franco, 6 years ago) (diff)

First draft, see #7682

How to create a WordPress network handling multiple domains

Draft. These instructions are roughly equivalent to a live multisite in bluehost, supporting 5 domains, everyone with at least two subdomains, making a total of 27 blogs running every one their contents and users/roles, also every one being able to chose apart of every other blog among a selection of themes and plugins, but sharing a common codebase easier to handle and upgrade, with some security and performance plugins enforced for all the blogs without the admins of every site being able to disable the network settings. This is proposed as a help to ticket:7682 and similar cases, but is has not being tested in MF/PL account with several domains, but only subdomains. Also, these are only the first steps to run a network and not a whole specification on security and performance matching the resources available to MF/PL members, since these are better than resources typically available to stock commercial shared hosting from which this experience comes.

How to create a WP multiblogs network

Prerequisites

  1. Domains pointing to MF/PL nameservers.
  2. Admin access, and SFTP access to editing wp-config and .htaccess
  3. Permalinks (clean URLs) working properly.

Domain mapping to MF/PL nameservers

Add New Domain to existing account.

Wildcard subdomain for WP network

This is not estrictly necessary, but it would help you a lot if your need to set up quickly a new subdomain inside your WP Network after it is properly configured.

Once you have set up your domain(s) to point to MF/PL nameservers, through your domain registrar panel and the MF/PL control panel, you should add another record into the DNS area of your account:

  • Record Type: A
  • Server Address: same IP of your domain.
  • Domain: *.yourexampledomain.net

Web Configuration to attach the domains to the WP network

  1. Inside your MF/PL control panel, go to the Web Configuration tab.
  2. Locate the record your site should be launched.
  3. Add to the ServerAlias, two entries: yourdomain (just in case you have not already added it through the Domain Mapping linked above) and the wildcard subdomain.
  4. Hit Submit and give it a minute to go active.

The ServerAlias column should look like this:
myuser.mayfirst.org example.com *.example.com

WP install and permalinks configuration

This is fairly basic stuff and if you are reading this you have probably managed the very easy installation of WP before. Just make sure your permalinks are working according to your needs on Settings -> Permalinks.

Tip: If you are running your site already with www url (www.example.com), you should temporarily convert it to example.com, in order to making easier to create the network of blogs in the first subdomains for your domains. Subdomain1.example.com, subdomain2.example are pretty easier to handle tha subdomain1.www.example.com... Once you have setup your network without www, you can go back to www.example.com since it helps a slighlty better performance.

Creating the Network

The procedure is well known and documented in the WordPress' Codex. This is a quick outline of the steps involved:

  1. Add to wp-config.php above /*That's all, stop editing*/ line, the next definition:
    define( 'WP_ALLOW_MULTISITE', true );

  2. Refresh or enter into your admin area, and go to Tools -> Network Setup.

  3. Choose subdomains install, and fullfill at least the next values: Server Address (remember, is easier without www.), Network Title (in example, for Radio Zapote, the Network is Rizoma Zapote), Admin E-mail Address (this email is going to receive notices of new blogs and user accounts created through the whole network).

  4. Get the code given to you by the wizard and place them accordingly:
    • New definitions, should be added to wp-config.php after ALLOW MULTISITE you inserted, and before /*...Stop editing...*/ comment.

    • New .htaccess directives should replace the previously created by WP on Permalinks setup. In contrast to Permalinks setup, WP is not going to add this rules to .htaccess by itslef, this is why you should have SFTP access to create the network.

  5. Re-login, if you are redirected, clean your cookies.

  6. Go to your Network Admin area and in the sites listing (http://example.com/wp-admin/network/sites/) and click the Add New item. You can now create new subdomains/blogs each one with their own admins, choosing among the themes you have installed on the network (the blogs' admins are not able anymore to add/delete/upgrade themes/plugins, only SuperAdmins should).

So far, we can host several subdomains with the same WP codebase shared among all of them (core, themes, plugins, and you need only upgrade once the software and not to doing that over and over on every site). But to make the network able to handle several domains, the easier way is through a domain mapping plugin:

Mapping multiple domains to the same network

While you shouldn't to install a new WordPress application for every new domain, you should make sure you are adding the domains according to the prerequisites listed before, mapping your domain first to MF/PL nameservers, then adding the domain and its wildcard subdomain to the ServerAlias of the same Web Configuration your current WP Network.

There are two plugins available for this ...

Beyond first Network

It's possible running several networks over the same codebase (WP core, themes, plugins), without the sunrise domain mapping plugins, but it involves a bit of work right into the wp_site and wp_sitemeta tables, as it's described here: http://webmasterformat.com/blog/multiple-wp-site-management While a bit more involved, the advantage is being able to define different sets of super-admins, themes and plugins enabled, for different networks/sites/domains. With the sunrise domain mapping plugins, all the blogs run on the same network which is easier to handle.

Attachments (1)

Download all attachments as: .zip