OpenSourceVarsity

pdf icons

Install WordPress 3.X In Multi Blog / Multi user mode On localhost

In this tutorial, we will cover how to setup WordPress as a Multi User /Multi Blog. We’ll start by downloading and installing a new version of WordPress on a local computer and then configure the WordPress CMS to support Multi User /Multi Blog functionality.

The following tutorial will guide you step by step to setup WordPress MU.

Download the latest version of WordPress:

Open a Browser window and enter http://www.google.com in the address bar and hit GO.

In the Google search windows that opens search for wordpress download as shown in Diagram 1.

diagram1 Diagram 1

In the Search results window Click on the WordPress.org link as shown in Diagram 2.

diagram2 Diagram 2

When the wordpress.org site opens in the Browser window click Download WordPress {version number} as shown in Diagram 3.

diagram3.png Diagram 3

Select the Save File radio button, and save the zip file to your hard disk. Click OK, as shown in Diagram 4.

diagram4 Diagram 4

On click of OK, a file browser will open up. Navigate to an appropriate folder on your hard disk and save the wordpress-{version_number}.zip to your local computer, eg: “X:\ public_html\multibloguser\” Here X:\ represents an appropriate drive letter on your computer as shown in Diagram 5. The zip file would be successfully downloaded and saved in this folder.

diagram5 Diagram 5

The WordPress Full_Package setup file downloaded from wordpress.org is a zipped file. Extract the entire contents of the archive into X:\public_html\multibloguser as shown in Diagram 6. Now Apache Web server needs to be informed of the existence of multibloguser.

diagram6 Diagram 6

This is done by adding virtual domain entries into Apache’s httpd.conf file.
The technique for doing this is described under the head Creating A WordPress Virtual Domain Under Apache.

Creating WordPress Virtual Domain Under Apache:

The location Apache’s httpd.conf file is normally:
C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf

NOTE: This is assuming that Apache was installed in C:\Program Files on your local computer.

Open httpd.conf file in any text (i.e. ASCII) editor of your choice.

Locate the code block contained within
<Directory “C:/Program File/Apache Software Foundation/Apache2.2/htdocs”> </Directory>.
Select the code block. Copy and Paste this code block immediately below the original.

NOTE: Please ensure that both <Directory . . . .> and the </Directory>tags exist.

Change <Directory “C:/Program Files/Apache Software Foundation/Apache2.2/htdocs” > </Directory>.
To <Directory “X:/public_html/multibloguser”> as shown in Diagram 7.

NOTE: Please note the use of the forward slash above.

diagram7 Diagram 7

These entries within Apache´s httpd.conf file ensure that Apache knows that X:\public_html\ multibloguser exists and that directory permissions are set.

Once Apache knows the existence and location of X:\public_html\ multibloguser, appropriate entries in the httpd-vhost.conf must be made.

httpd-vhost.conf is normally located at:
C:\Program Files\Apache Software Foundation\Apache2.2\conf\extra\httpd-vhosts.conf

Open the above conf file in any other text (i.e. ASCII) editor of your choice.

Copy the <VistualHost *.80 > block of code and paste it immediately below the original code block.

Now, when multiple Blogs are setup, each Blog should be configured to run as a subdomain of the main Blog installation. Here is where the DNS issue raises its head.

Normally the Main Blog will have its URL which would be something like www.parentblog.com. Assuming one requires another Blog, let’s say firstchild to run as a subdomain its URL will be child1.www.parentblog.com which will definitely return a 404 – Page not found error from Apache web server.

WordPress cannot handle a URL that is structured as child1.www.parentblog.com , what WordPress can handle is a URL that reads child1.parentblog.com (which is without www)

Hence when creating the virtual domain under Apache for the parent Blog ensure that the ServerName directive in the httd-vhosts.conf file is set to parentblog.com and not to www.parentblog.com as is often the case.

Additionally, do remember to ensure the ServerAlias directive in the httd-vhosts.conf file carries the value *.parentblog.com . This directive sets the alternate names for a host(ServerName).

Make the following changes as shown in Diagram 8.

ServerAdmin: <Email Id>

DocumentRoot: <Path where your virtual domain is located>

ServerName: <Name of the website, in our case – multibloguser.com>

ServerAlias:<wildcard entries of Server Name, in our case – *.multibloguser.com>

ErrorLog: <Folder where all Apache errors logs will be stored>

CustomLog: <Comment the CustomLog>

diagram8 Diagram 8

After making all the above entries in both httpd.conf and httpd-vhost.conf, please Restart Apache Web Server.

NOTE: The Apache Web Server icon is normally visible in the status bar of the Window (Look at the extreme right hand side of the status bar)

If Apache Web Server does not restart please check all the entries made in the httpd.conf and httpd-vhost.conf files.

HOST File Entries

Now it’s time to make entries in Windows HOSTS file as shown in Diagram 9.
The HOSTS file contains mappings of IP addresses to host names.
There must be a single IP address / host name pair on a single line in the HOSTS file.

NOTE: The IP address and the Host name must be separated by a TAB.

The HOSTS file is normally located at C:\WINDOWS\system32\drivers\etc\hosts

When you open the hosts file in your favorite ASCII editor and it contains the some entries.

If your hosts file contains the entry:
#127.0.0.1 localhost

Simply copy / paste this entry in your hosts file, so that you have duplicate entries.

Then remove # sign in front of the second line, ( i.e. the one you just copy / pasted ) to activate it.
NOTE: The # symbol at the start of any line tells Apache to ignore the line completely.

Your host file entries should look like this:
#127.0.0.1 localhost
127.0.0.1 localhost
As shown in Diagram 9.

diagram9 Diagram 9

The next few entries will be the URL’s of your main Blog and its associated child Blog’s so that while testing your installation, your Browser will get its URL to ip resolved from within your hosts file as shown in Diagram 10.

The hosts file will contain the following entries of the main blog and child blogs:

#127.0.0.1 localhost
127.0.0.1 localhost

127.0.0.1 multibloguser.com
127.0.0.1 prerna. multibloguser.com
127.0.0.1 meher. multibloguser.com

If you want to add any other child blog to your main blog in your local Apache installation, simply add another line structured as an – IP followed by the respective Blog URL.

diagram10 Diagram 10

Before proceeding, open MySQL command prompt and

  1. Create a new database in MySQL
  2. Create a new MySQL user with a strong password
  3. Bind the newly created user to the newly created database
  4. Grant all permissions to the user on the newly created database.

In our case, we have created database named multibloguser and username multibloguser. The user multibloguser has all possible permissions to access and use the MySQL database multibloguser as desired.

WordPress Installation:

Open a Browser and type multibloguser.com in the address bar i.e. the domain name entry made in the hosts file and hit GO.

This will automatically invoke index.php. When index.php executes, the WordPress installation process is started.

If you have not created a configuration file, WordPress will prompt you to first create a Configuration file. Click Create a Configuration file as shown in Diagram 11.

diagram11 Diagram 11

A new page opens which tells the user that before proceeding you need to know the WordPress Database Name, Username and Password created by you.

Click on the Lets Go as shown in Diagram 12.

diagram12 Diagram 12

The database connection details page opens. Fill in all the details as shown in Diagram 13.

diagram13 Diagram 13

Click onto the Run the install which completes the installation of WordPress as shown in Diagram 14.

diagram14 Diagram 14

A new page opens in your Browser as shown in Diagram 15.

Enter the Blog Title and Your E-mail.

If you want you can change the username. By default WordPress set admin as username.

Enter a strong password for the administrator backend login.

Click onto the Install WordPress as shown in Diagram 15.

diagram15 Diagram 15

WordPress is finally installed on your system.

A new page opens in your browser, which provides you with the username and password of the WordPress admin section as shown in Diagram 16.

Click Log In.

diagram16 Diagram 16

Now, you can login to the WordPress backend administrative section by using the username and password created by you earlier.

diagram17 Diagram 17

Instructing WordPress To Deliver Multi Blog / Site Functionality

In your WordPress files and folder, locate wp-config.php file in the root of your directory structure.

Right click and open wp-config.php file in any ASCII editor as shown in Diagram 18.

diagram18 Diagram 18

Search for the line /* That’s all, stop editing! Happy blogging. */ which is normally found towards the end of the wp-config file as shown in Diagram 19.

Place your mouse cursor just above this line ( which is just a remark statement ) and press the Enter key a few time to make some space just above the line.

diagram19 Diagram 19

Copy / Paste the following code snippet just above this remark statement:

define(‘WP_ALLOW_MULTISITE’, true); as shown in Diagram 20.

Once done, Save the wp-config.php file back to hard disk.

NOTE: This code snippet instructs the WordPress core that it’s required to work in multi site from now on.

diagram20 Diagram 20

Next go to the WP administrative login, and refresh the page if it is already open as shown in Diagram 21 and open the WordPress dashboard.

diagram21 Diagram 21

Enter the main blog’s username and password. Click Log In as shown in Diagram 22.

diagram22 Diagram 22

In the left menu, locate the link Tools. Click Tools as shown in Diagram 23.

diagram23 Diagram 23

From the drop down menu that appears click on Network Setup as shown in Diagram 24.

diagram24 Diagram 24

The Network Installation process will start from here. From here you can select the type of address you want to access the child blog’s site. There are two options Sub-domains and Sub-directories. By default WordPress, set Sub-domains as selected option as shown in Diagram 25. You cannot change the option later once you click Install.

The Network details will automatically gets filled up by WordPress as shown in Diagram 25. Click Install.

diagram25 Diagram 25

In order to enable network, follow the written instruction in the browser page as shown in Diagram 26.

NOTE: Before doing this, please backup your wp-config and .htaccess files.

diagram26 Diagram 26

After completing the following steps:

  1. Create a blogs.dir directory inside wp-content directory. This directory is used to store uploaded media for the additional Blog sites and must be writeable by the web server.
  2. Adding the following codespec in wp-config.php file above the /* That’s all, stop editing! Happy blogging. */ line.

Text Box 1 contains the additional code block that must be added to wp-config.php file:

define( ‘MULTISITE’, true );
define( ‘SUBDOMAIN_INSTALL’, true );of
$base = ‘/’;<br />
define( ‘DOMAIN_CURRENT_SITE’, ‘multibloguser.com’ );
define( ‘PATH_CURRENT_SITE’, ‘/’ );
define( ‘SITE_ID_CURRENT_SITE’, 1 );
define( ‘BLOG_ID_CURRENT_SITE’, 1 );

Text Box 1

  1. 3. Add the following codespec in .htaccess file

NOTE: If there are any WordPress rules within the .htaccess that exist these must be deleted.

Next copy and paste the code visible in Text Box 2 into the .htaccess file normally found in the root directory of a WordPress Blog.

Here is what the additional code block that will be added to wp-config.php file:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ – [L]
RewriteRule . index.php [L]

Text Box 2

After adding all the necessary codespec in wp-config and .htaccess file, the WordPress CMS is now ready to be informed about all the multiple sites / Blog that it has to handle.

For that you have to log in again ( as instructed during enabling the network process ). Re-login to the WordPress main blog.

When you re-login, you will see a new menu link called My Sites under Dashboard Menu as shown in Diagram 27. Click MySites

diagram27 Diagram 27

In WordPress 3.0, you had a new menu for Super Admin, but as of 3.1 you have an entire sub-section for Network Admin. The link can be found on the upper-right of all admin screens, by your name as shown in Diagram 28.

diagram28 Diagram 28

WordPress Network Admin’s dashboard opens as shown in Diagram 29.

diagram29 Diagram 29

While you are Network Admin, Click Create a New Site on the Dashboard screen as shown in Diagram 30.
OR
In the left menu, locate the link Sites. Click Sites from the drop down menu that appears click Add New.

diagram30 Diagram 30

Enter the following information as per your requirement:

Site Address – prerna {Enter the child blog’s address here}
Enter the Blog Title – Prerna’s Blog {Enter the child blog’s site title}
Enter the Admin Email Id – {Enter a legitimate Email ID here}
NOTE: Ensure that a unique Email ID is used for each such new site / Blog

Having done this a new site / Blog will be created named prerna under the parent Blog which you installed and just configured to deliver multiple sites / Blogs.

Click Add Site as shown in Diagram 31.

diagram31 Diagram 31

“Site added” message is displayed as shown in Diagram 32.

diagram32 Diagram 32

Now in a new Browser tab I entered the URL – prerna dot multibloguser dot com in the address bar and Prerna’s Blog, Home Page was displayed as shown in Diagram 33.

diagram33 Diagram 33

Now you have to separate Blogs the parent Blog named WP Multi Blog User Site and Prerna’s Blog both being independent of each other but delivered by the same WordPress installation.

If you wish to add more Blogs then simply go back to being Network Admin > Sites > Add New > Create A New Site and – add another site.

Each of the Blogs will have their own independent Admin Dashboards displayed.

April 28, 2016
Design by Ivan Bayross and Meher Bala © 2017 All Rights Reserved
X