In WordPress 3.0+, a multisite network is a collection of sites that share the same WordPress installation. They can also share plugins and themes. This structure makes sense when you would like to have more than one site sharing the same Pugpig plugin.
IMPORTANT: A network can only be created if our WordPress URL uses ports :80 or :443. Change your port accordingly before setting up the site.
Setting up WordPress Multisite
1. Prepare your WordPress
- Backup your database and files.
- Deactivate all active plugins.
2. Allow multisite
To enable the Network Setup menu item we must first specify 'multisite' in the wp-config.php file.
To do that, add the following line above the comment /* That's all, stop editing! Happy blogging. */. If the comment doesn't exist in the file, add the line somewhere above the first line that begins with require or include:
/* Multisite */ define('WP_ALLOW_MULTISITE', true);
Refresh the browser.
3. Install a Network
Let's go to the newly created panel
Tools > Network Setup
As the figure below shows, we need to decide whether we want our multiple sites to appear as sub-domains or as sub-directories. We can leave the Network Details as they are, or modify them if we need to. Press Install.
Note: You only need wildcard DNS for on-demand domain-based sites, despite the advice that may be on the screen.
4. Enable the Network
If this is not a fresh install, back up the existing wp-config.php and .htaccess files.
As the screen indicates, add the specified customized lines to wp-config.php and .htaccess. When done, click the Log In link.
You will now see a new 'My Sites' item on the toolbar, where all your sites will be listed, and through which you can access the Network Administration options.
Adding a new site
It is advisable to keep all wordpress projects in an external folder, such as
Documents > Projects.
Thus, you can link the plugins and theme folders of each of them to the WordPress multisite as follows:
To create a symbolic link through the command line, cd into the folder where you want to create the link and run the command below:
ln -s /path/to/the/folder/in/question
1. Add site in WordPress dashboard
My Sites (top toolbar) > Network Admin. Click on the Create a New Site link. This action will take us to the screen below. We just need to enter the site’s details and click Add Site.
REQUIRED: EMPTY THE PERMALINK CACHE BY VIEWING THE
Settings > Permalinks PAGE
In order to view your new site in the admin bar
My Sites (admin bar) > Network Admin > All Sites (left panel) > Edit Site > Users > Add User
WordPress user roles: Wordpress users can be assigned the following roles:
- Super Admin: somebody with access to the site network administration features and all other features.
- Administrator: somebody who has access to all the administration features within a single site.
- Editor: somebody who can publish and manage posts including the posts of other users.
- Author: somebody who can publish and manage their own posts.
- Contributor: somebody who can write and manage their own posts but cannot publish them.
- Subscriber: somebody who can only manage their profile.
Now you should be able to view and access your new site.
If you can’t see the site in the My Sites dropdown ensure the user that you are using is added to the site.
2. Configure the new site in Apache
Add the new domain to /private/etc/hosts and include a new virtual host in httpd-vhosts.conf.
Restart Apache. Done!
3. Enable Pugpig
There’s no need to activate it, as it is already enabled for the whole network.