Installing the Network on Your Site

The Network Details heading on the Create a Network page has options filled in automatically. The server address, for example, is pulled from your installation and isn't editable. The network title and administrator e-mail address are pulled from your installation database, too, because your initial WordPress site is the main site in the network. Clicking the Install button causes WordPress to create new network tables in the database. The page refreshes and the Create a Network of WordPress Sites page appears, as shown in Figure 2-3.

From the Create a Network of WordPress Sites page, follow these steps to install the multisite feature after you install the network. Note: These steps require that you edit Web server files, so be sure to have your text editor program handy.

  1. Create a directory on your Web server called blogs.dir.

    In your WordPress installation directory is a folder labeled /wp-content/. In that folder, create your new directory, which stores all the uploaded media (photos, videos, audio, and other media) within the network sites on your domain. The entire path should look similar to /public_html/wp-content/blogs.dir.

    image Most FTP programs allow you to create a new directory (or a new folder) by right-clicking in the Web server window and choosing Make New Directory. For more information about FTP, see Book II, Chapter 2.

  2. Add the network-related configuration lines to the wp-config.php.

    On the Create a Network of WordPress Sites page, WordPress gives you up to seven lines of configuration rules that need to be added to the wp-config.php file. The first line includes the line you added earlier in this chapter: define(‘multisite’, true );. You can skip that line, copy the rest of the lines, and then paste them beneath the define(‘multisite’, true); line in your wp-config.php. The lines of code you add look like this:

    define( 'SUBDOMAIN_INSTALL', true );
    $base = '/ '
    define( 'DOMAIN_CURRENT_SITE', 'localhost' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    Figure 2-3: The Create a Network page.

    image

    These lines of code provide configuration settings regarding subdomains, the base URL of your Web site, and your Web site's current path. Additionally, it assigns a unique ID of 1 to your Web site and blog for the main installation site of your multisite network.

    image The lines of code on the Create a Network of WordPress Sites page are unique to your installation of WordPress and specific to your site setup so make sure that you copy the lines of code from your installation.

  3. Add the rewrite rules to the .htaccess file on your Web server.

    WordPress gives you up to 13 lines of code that you need to add to the .htaccess file on your Web server in the WordPress installation directory. The lines look something like this:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.
        php?file=$2 [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).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*.php)$ $1 [L]
    RewriteRule . index.php [L]

    image In Chapter 1 of this minibook, we discuss the Apache mod_rewrite module. You must have it installed on your Web server to run the WordPress multisite feature. The rules you add to the .htaccess file on your Web server are mod_rewrite rules. They need to be in place so that your Web server tells WordPress how to handle things, such as permalinks for blog posts and pages, media, and other uploaded files. Without these rules in place, the WordPress multisite feature will not work correctly.

  4. Copy the lines of code from the Create a Network of WordPress Sites page, open the .htaccess file, and paste the lines of code there.

    Completely replace the rules that already exist in that file.

  5. Save the .htaccess file and upload it to your Web server.
  6. Return to the Dashboard and click the Dashboard link at the top of the menu navigation.

    You may be asked to log in to WordPress again because you have changed some of the browser cookie-handling rules in the wp-config.php and .htaccess files.

Completion of the installation steps activates a Network Admin menu item in the upper-right menu of links in your WordPress Dashboard. The Network Admin section is where you, as the site owner, administer and manage your multisite WordPress network. (See Chapter 3 of this minibook.)

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset