Chapter 13
In This Chapter
Deciding whether multiple sites are for you
Exploring web-hosting considerations
Enabling the WordPress Network capabilities
Administering and managing a network
Diverting spammers and sploggers
In this chapter, I introduce you to the network feature that is built in to the WordPress software. The network feature allows you, the site owner, to add and maintain multiple blogs within one installation of WordPress. In this chapter, you discover how to set up the WordPress network feature, explore settings and configurations, gain an understanding of the Network Administrator role, determine which configuration is right for you (do you want subdirectories or subdomains?), and find some great resources to help you on your way.
With the network features enabled, users of your network can run their own sites within your installation of WordPress. They also have access to their own Dashboard with the same options and features as you’ve read about in the past 12 chapters. Heck, it would probably be a great idea to buy a copy of this book for every member within your network so everyone can become familiar with the WordPress Dashboard and features, too. At least have a copy on hand so people can borrow yours!
This chapter assumes that you already have the WordPress software installed and running correctly on your web server, and that your web server meets the minimum requirements to run WordPress (see Chapter 2).
Before you enable the WordPress network feature, you need to determine how you are going to use the feature. You have a couple of options:
If you are planning to run just a few of your own sites with the WordPress network feature, your current hosting situation is probably well suited (see Chapter 3 for information on web-hosting services). However, if your plans are to host a large network with hundreds of blogs and multiple users, you should consider contacting your host and increasing your bandwidth, as well as the disk space limitations on your account.
The best example of a large, multisite network with millions of websites and users is the hosted service at WordPress.com. At WordPress.com, people are invited to sign up for an account and start a website using the network feature within the WordPress.com platform on the WordPress.com server. When you enable this feature on your own domain and enable the user registration feature (covered later in this chapter), you are inviting users to:
Many WordPress Network communities start with grand dreams of being a large and active community — be realistic about how your community will operate in order to make the right hosting choice for yourself, and your community.
Small multisite communities can be easily handled using a shared-server solution, whereas larger, more active communities should really consider a dedicated server solution for operation. The difference between the two lies in their names:
A dedicated server solution is a more expensive investment for your blog community, whereas a shared-server solution is the most economical. Your decision on which solution to go with for your WordPress Network blogging community will be based on your realistic estimates of how big and how active your community will be. You can move from a shared-server solution to a dedicated server solution if your community gets larger than you expected; however, it is easier to start with the right solution for your community from day one.
WordPress makes it pretty easy to enable the network feature, but it does require opening a file on your web server called wp-config.php and making a small alteration. Follow these steps to get the process started:
Download the file called wp-config.php from the WordPress installation on your web server.
It’s easiest to use an FTP program to download a copy of this file from your web server to your computer. Chapter 3 covers the information you need about using FTP.
Using your preferred text editor, open the wp-config.php file.
PC users can use Notepad to edit the file; Mac users can use TextEdit.
Type define ( ‘WP_ALLOW_MULTISITE’, true );
Save the file to your computer as wp-config.php. Your wp-config.php file should look similar to mine, shown in the code on line 37 in Figure 13-1. Save the wp-config.php file to your computer.
Go to your WordPress Dashboard in your browser.
You now see a new item, labeled Network Setup, under the Tools menu.
Click the Network Setup link in the Tools menu.
A page called Create a Network of WordPress Sites loads in your browser window, shown in Figure 13-2.
Before proceeding with the final steps in enabling the WordPress network feature, you need to get a few items in order on your web server. You also need to make a decision about how the multiple sites within your network will be handled. These configurations need to be in place so that you can run the WordPress Network successfully. If you can perform the configurations in this section yourself (and if you have access to the Apache configuration files), this section is for you. If you don’t know how, are uncomfortable with adjusting these settings, or don’t have access to change the configurations in your web server software, ask your hosting provider for help or hire a consultant to perform the configurations for you. You can hire a consultant that is local to your area, or several consultants are available worldwide who can work with you remotely. A listing of consultants can be found on the Code Poet (by Automattic) website: http://directory.codepoet.com/
.
The WordPress network feature gives you two different ways to run a network of sites on your domain, with one installation of WordPress. You can use the subdomain option or the subdirectory option. The most popular option (and recommended structure) sets up subdomains for the sites created by your WordPress Network. With the subdomain option, the username of the blog appears first, followed by your domain name. With the subdirectory option, your domain name appears first, followed by the username of the blog. Which one should you choose? The choice is yours. You can see the difference in the URLs of these two options by comparing the following examples:
http://username.yourdomain.com
.http://yourdomain.com/username
.If you want to use a subdomain for each site in your WordPress Network, you must add a wildcard record to your DNS records. You need to add a hostname record pointing at your web server in the DNS configuration tool available in your web-server administration software (such as WebHost Manager [WHM], a popular web-host administration tool). The hostname record looks like this: *.yourdomain.com (where yourdomain.com is replaced with your actual domain name).
Apache (http://httpd.apache.org
) is web-server software that’s loaded and running on your web server. Not everyone has access to Apache files, however. Usually, the only person who has access to those files is the web-server administrator. (This is usually your web host.) Depending on your own web server account and configuration, you may or may not have access to the Apache software files.
The Apache module that’s necessary for the WordPress Network to create nice permalink URLs (see Chapter 5 for information on pretty permalinks) is called mod_rewrite. This module must be configured so that it’s active and installed on your server.
You or your web host can make sure that the Apache mod_rewrite module is activated on your server; open the httpd.conf file and verify that the following line is included within:
LoadModule rewrite_module /libexec/mod_rewrite.so
If it isn’t, type that line on its own line and save the file. You will probably need to restart Apache before the change takes effect.
In the same httpd.conf file that I discussed two paragraphs ago, you need to make some adjustments to the <VirtualHost> section of that file. Follow these steps:
Find the <VirtualHost> section in the httpd.conf file.
This line of the httpd.conf file provides directives, or configurations, that apply to your website.
AllowOverride None
AllowOverride FileInfo Options
On a new line, type ServerAlias *.yourdomain.com .
Replace yourdomain.com with whatever your domain is. This line defines the host name for your Network site and is essential for the virtual host to work correctly.
In this section, you edit the PHP configuration on your web server. PHP needs to have the following configurations in place in the php.ini file on your web server to run WordPress Multisite on your server:
php_flag register_globals 0
php_flag display_errors 0
The Network Details heading on the Create a Network of WordPress Sites page has options filled in automatically (refer to Figure 13-2). The server address, for example, is pulled from your installation and isn’t editable. The network title and administrator email address are pulled from your installation database, too, because your initial WordPress site is the main site in the network.
Follow these steps to complete the installation of the Multisite Feature on the Create a Network of WordPress Sites page that appears after you install the Network in the previous section — be sure to have your preferred text editor program handy, as you will be editing files in the following steps:
Click the Install button at the bottom of the Create a Network of WordPress Sites page in your WordPress Dashboard.
This opens the Enabling the Network page in the network Dashboard.
Add the Network-related configuration lines to the wp-config.php .
On the Create a Network of WordPress Sites–Enabling the Network page, WordPress gives you up to six lines of configuration rules that need to be added to the wp-config.php file. The lines of code you add look something like this:
define(‘MULTISITE’, true);
define(‘SUBDOMAIN_INSTALL’, false);
define(‘DOMAIN_CURRENT_SITE’, ‘localhost’);
define(‘PATH_CURRENT_SITE’, ‘/’);
define(‘SITE_ID_CURRENT_SITE’, 1);
define(‘BLOG_ID_CURRENT_SITE’, 1);
These lines of code provide configuration settings for WordPress by telling it whether it is using subdomains, what the base URL of your website is, and your site’s current path. This code also assigns a unique ID of 1 to your website and blog for the main installation site of your WordPress Multisite network. By default, WordPress sets up your network to use subdirectories, instead of subdomains. If you would like to use subdomains, change this line of code: define('SUBDOMAIN_INSTALL', false); to define('SUBDOMAIN_INSTALL', true);. Make sure that you have the VHost and Apache mod_rewrite configurations on your server in place before you do this.
The lines of code that are given to you on the Create a Network of WordPress Sites page are unique to your installation of WordPress. Make sure that you copy the lines of code that are given to you on the Create a Network of WordPress Sites page on your installation because they are specific to your site’s setup.
Add the Rewrite Rules to the .htaccess file on your web server.
WordPress gives you several lines of code that you need to add to a file called .htaccess on your web server. You find that file in the WordPress installation directory. These lines look something like this:
RewriteEngine On
RewriteBase /wpfd/
RewriteRule ^index.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
RewriteRule . index.php [L]
Earlier in this chapter, I discussed the required Apache module called mod_rewrite and how you must have that installed on your web server to run WordPress Multisite. The rules that you just added to the .htaccess file on your web server are mod_rewrite rules, and they need to be in place so that your web server tells WordPress how to handle things like permalinks for blog posts, pages, media, and other uploaded files. Without these rules in place, the WordPress multisite feature will not work correctly.
Copy the lines of code from the Create a Network of WordPress Sites: Enabling the Network page in Step 3. Then open the .htaccess file and paste the lines of code there.
Completely replace the rules that already exist in that file.
Return to your WordPress Dashboard and click the Log In link at the bottom of the Create a Network of WordPress Sites: Enabling the Network page.
You are logged out of WordPress because by following these steps, you have changed some of the browser cookie-handling rules in the wp-config.php and .htaccess files.
With the WordPress Network now fully enabled and configured, you see a new link in the menu at the top right of your WordPress Dashboard called My Sites. In this section, I show you how to become a Network Admin and explain everything you need to know about being a Network Admin in your new WordPress Network.
With the network (or multisite) feature enabled, you see the link to My Sites — if you hover your mouse pointer over that link, the Network Admin link displays in the drop-down menu on the upper-left side of the Dashboard, as shown in Figure 13-3. WordPress has separated the Network Admin menu features from the rest of the regular (Site Admin) Dashboard menu features to make it easier for you to know which part of your site you are managing. For example, if you are performing actions that maintain your main website — publishing posts or pages, creating or editing categories, and so on — you work on the regular Dashboard (Site Admin). However, if you are managing any one of the network sites, plugins, and themes for the network sites or registered users, you work in the Network Admin section of the Dashboard.
The Network Admin Dashboard (see Figure 13-4) looks similar to the regular WordPress Dashboard, but as you may notice, the modules shown on the Network Admin Dashboard pertain to the network of sites. Options there include letting you create a new site, create a new user, and search existing sites and users. Obviously, you won’t perform this search if you don’t have any users or sites yet. However, this function is extremely useful when you have a community of users and sites within your network.
The Search Users feature allows you to search usernames and user email addresses. If you search for the user Lisa, for instance, your results include any user whose username or email address contains Lisa — so you can receive multiple returns when using just one search word or phrase. The Search Sites feature returns any sites within your network that match the terms you’ve searched for.
The Network Admin page has two useful links near the top left of the page:
Additionally, the WordPress Network Admin page gives you a real-time count of how many sites and users you have in your network, which is nice-to-know information for any Network Admin.
As mentioned, the Network Admin Dashboard has its own set of unique menus separate from the regular Site Admin Dashboard. Those menus are located on the left side of the Network Admin Dashboard. This section goes through each menu item and provides you with explanations and instructions on how to work with the different settings and configurations to help you manage your network, sites, and users.
The full list of menus available on the Network Admin Dashboard includes
All the items in the Network Admin Dashboard are important, and you will use them all frequently throughout the life of your network. Typically, I would take you through each of the menu items in order so that you could easily follow along on your own Dashboard; however, you should set some important preliminary configurations for your network before you do anything else, so the following section starts with the Settings menu and then takes you through all the other menu items in order of appearance on the Network Admin Dashboard.
Click the Settings menu link on the Network Admin Dashboard. The Network Settings page loads in your browser window. The Network Settings page contains several sections of options for you to configure to set up your network the way you want.
The Operational Settings section, shown in Figure 13-5, has Network Title and Network Admin Email:
The Registration Settings section (see Figure 13-5) allows you to control aspects of allowing users to sign up to your network. The most important option is whether to allow open registration.
Decide how you want to handle registration on your network and select one of the following options by selecting the radio button to the left of each option:
These options apply only to outside users. As a Network Admin, you’re able to create new sites and users at any time you would like by using options available to you on the Network Admin Dashboard (see the information about creating new users in the “Users” section, later in this chapter).
The remaining options under the Registration Settings heading are as follows:
The New Site Settings section is a configurable list of items that populates default values when a new site is created. These include the values that appear in welcome emails, on a user’s first post page, and on a new site’s first page, as shown in Figure 13-6.
Welcome Email: This is the text of the email that owners of newly registered sites in your network receive after their registration is complete. You can leave the default message in place, if you’d like. Or you can type the text of the email you want new site owners to receive when they register a new site within your network.
A few variables you can use in this email aren’t explained entirely on the Site Options page, including
First Post: This is the first, default post displayed on every newly created site in your network. WordPress provides you with some default text that you can leave in place, or you can type your desired text in the provided text box that you want to appear in the first post on every site that’s created in your community.
You can use this area to provide useful information about your site and services. This also serves as a nice guide for new users because they can view that post on their Dashboard, on the Edit Post page, and see how it was entered and formatted; it therefore can serve as a guide for creating their own blog posts. You can also use the variables described in the bullet points in the Welcome Email bullet (earlier in this list) to have WordPress automatically add some information for you.
The Upload Settings section (see Figure 13-7) defines global values pertaining to the type of files you will allow the site owners within your network to upload using the file upload feature in the WordPress Add Media window (see Chapter 6). The types of files that site owners can upload include
The first option in the Upload Settings section is Site Upload Space. The amount is in megabytes (MB), and the default storage space is 100MB. This amount of hard drive space is what you give users to store the files they upload to their blog. If you want to change the default storage space, type a number in the text box provided.
The next text field is labeled Upload File Types, which defines the types of files that you, as the Network Admin, will allow the site owners to upload to their sites on their Dashboards. Users cannot upload any file types that do not appear in this text box. By default, WordPress includes the following file types: .jpg, .jpeg, .png, .gif, .mp3, .mov, .avi, .wmv, .midi, .mid, .mt2s, and .pdf. You can remove any default file types and add new ones.
The final option under Upload Settings defines the Max Upload File Size. This amount is in kilobytes (K), and the default file size is 1500K. This means that a user cannot upload a file that is larger than 1500K. Adjust this number as you see fit by typing a new number in the text box provided.
The Plugins administration menu is disabled within the Dashboard of all network sites (except for the Network Admin). However, the Network Admin always has access to the Plugins menu. If you leave this option unselected, the Plugins page is visible to users on their own site’s Dashboard. Select the box to enable the Plugins administration menu for your network users (see Figure 13-7). For more information about using plugins with WordPress, see Chapter 7.
Clicking the Sites menu item on the Network Admin Dashboard takes you to the Sites page, where you can manage your individual sites. Although each site in the network has its own Dashboard for basic tasks, such as posting, changing themes, and so on, the Sites page is where you create and delete sites and make edits to properties of the sites within your network. Editing information from this page is handy when you have issues accessing a site’s Dashboard.
The Sites page also lists all the sites within your network. The listing shows the following statistics about each community site:
When you hover your mouse pointer over the path name of a site in your network, you see a handy listing of links that help you manage the site. The options that appear underneath a site listing when you hover on a site name in the list include:
Generally, you use the Edit Site page only when the settings are unavailable from the Dashboard of that particular site, by configuring the options that appear underneath each of the four tabs on the Edit Sites page, as shown in Figure 13-9:
Also in the Sites menu on the Network Admin Dashboard, you see a link called Add New — click that link to load the Add New Site page on your Network Admin Dashboard. You can create a new site from the Add New Site page, shown in Figure 13-10. Fill in the Site Address, Site Title, and Admin Email fields and then click the Add Site button to add the new site to your network. If the Admin Email you entered is associated with an existing user, the new site is assigned to that user in your network. If the user doesn’t exist, a new user is created and an email is sent with a notification. The site is immediately accessible. The user receives an email containing a link to his site, a login link, and his username and password.
Clicking the Users menu link on the Network Admin Dashboard takes you to the Users page, where you see a full listing of members, or users, within your network. The Users page (see Figure 13-11) lists the following information about each user:
Similarly to the Sites page, you can add and delete users to the network, as well as manage users by clicking either the Edit or Delete link that appears under their names when you hover over them with your mouse pointer (just as you do with sites on the Sites page).
To delete a user, simply hover over the username in the list that appears on the Users page. Click the Delete link and a new screen appears with a page telling you to transfer this user’s posts and links to another user account (yours, most likely). Then click the Confirm Deletion button, and WordPress removes the user from the network, permanently. This action is irreversible, so be certain about your decision before you click that button!
You can also edit a user’s profile information by clicking the Edit link that appears underneath his name when you hover your mouse pointer over it on the Users page. Clicking that link takes you to the Edit User profile page, shown in Figure 13-12, where you are presented with several options, which just happen to (mostly) be the very same options and settings that you configured for your own profile information in Chapter 4.
The only difference with the Edit User profile page within the Network Admin Dashboard is one setting labeled Grant This User Super Admin Privileges for the Network. This setting is deselected by default; however, if you select this box, you grant this user Network Admin privileges for your network. Basically, this means that the user has the exact same access and permission as you do.
Also in the Users menu on the Network Admin Dashboard, you see a link called Add New; click that link to load the Add New User page on your Network Admin Dashboard (see Figure 13-13).
You can add a new user from the Add New User page by filling in the Username and Email fields of the user you’d like to add and then clicking the Add User button. The new user is sent an email notification alerting her of the new account, along with the site URL, her username, and her password (randomly generated by WordPress at the time the user account is created).
When a network is enabled, only users with Network Admin access have permission to install themes, which are shared across the network. You can review details on how to find, install, and activate new themes with your WordPress installation in Chapter 8. After you install a theme, you must enable it in your network to have the theme appear in the Appearance menu of each site, where users in your network can activate it on their site. To access the network Themes page (shown in Figure 13-14), click the Themes link under the Themes menu on the Network Admin Dashboard.
By and large, all WordPress plugins will work on your network. There are, however, some special plugins and some special considerations for using plugins with a network.
Browse to the Plugins page on your WordPress Network Admin Dashboard by clicking the Plugins link under the Plugins menu. You find that the Plugins page is just as described in Chapter 7, but if you don’t know where to look, you can easily miss one very small, subtle difference. Check out Figure 13-15 and have a look below the name of the plugin. Do you see the Network Activate link? That is the big difference between plugins listed on the regular Dashboard and those on the Network Admin Dashboard. As the Network Admin, you can enable certain plugins to be activated globally, meaning across your entire network. This means that all sites in your network will have the network activated plugin features available on their site, in contrast to plugins that you activate on the regular Dashboard (under Site Admin), which are activated and available only for your main website.
Only the Network Admins have access to install new plugins on the site; regular users within the network do not have that kind of access (unless you’ve made them Network Admins in their User settings).
Also located in the Plugins menu on the Network Admin Dashboard are two other links: Add New and Editor. The Add New link lets you add and install new plugins by searching the WordPress Plugin Directory within your Dashboard, and the Editor link gives you access to the Plugin Editor. I cover these topics in more detail in Chapter 7.
Clicking the Updates link on the Network Admin Dashboard menu gives you access to the WordPress Updates page, which takes you through the same process of upgrading your WordPress installation software. WordPress takes the extra step of also upgrading all sites within your network so that they are all using the same, upgraded feature sets.
If the process of upgrading network sites stalls or stops, the URL of the last site upgraded appears on the WordPress Updates page. The Network Admin can access the Dashboard of the site where the upgrade stopped, which usually clears up the issue. A user accessing his site Dashboard after an upgrade also triggers the process of completing the upgrade.
If you choose to have open signups in which any member of the public can register and create a new site on your network, at some point, automated bots run by malicious users and spammers will visit your network signup page and attempt to create one, or multiple, sites in your network. They do so by automated means, hoping to create links to their sites or fill their site on your network with spam posts. This kind of spam blog or site is a splog.
Spam bloggers don’t hack your system to take advantage of this; they call aspects of the signup page directly. You can do a few simple things to slow them down considerably or stop them altogether.
In the “Registration Settings” section earlier in this chapter, I go over a few options, including areas in which you can specify email addresses to allow or block. The Add New Users check box (refer to Figure 13-5) stops many spammers when it is deselected. When spammers access the system to set up a spam site, they often use the Add New Users feature to programmatically (through the use of programs built into the bots) create many other sites.
Spammers often find your site via Google Search, and that’s where they find the link to the signup page. You can stop Google and other search engines from crawling your signup page by adding rel=nofollow,noindex on the signup page link. To do so, wherever you add a link to your signup page, inviting new users to sign up, the HTML code you use to add the nofollow,noindex looks like this:
<a href="http://yoursite.com/wp-signup.php" rel="nofollow,noindex ">Get your own site here</a>
You can add this code to any page or widget area as a normal link to instruct legitimate visitors to sign up for a site in your network.
Plugins can help stop spam blogs, too. The Moderate New Blogs plugin interrupts the user signup process and sends you (the Network Admin) an email notification that a user has signed up for a site. You can then determine whether the site is legitimate. Download the plugin at https://wordpress.org/plugins/moderate-new-blogs
.
The WangGuard plugin was written mainly to stop sploggers and prevent spam signups on a WordPress site — with or without the network feature activated. You can get the plugin at https://wordpress.org/plugins/wangguard
. This plugin is free for personal use, or for sites with fewer than 500 daily user registrations.
The Cookies for Comments plugin (available at
https://wordpress.org/plugins/cookies-for-comments
) leaves a cookie in a visitor’s browser. If the signup page is visited, the plugin checks for the cookie. If there isn’t a cookie, the signup fails. Be sure to check the installation directions on this because it requires an .htaccess file edit.
18.188.10.246