Comet ISON 2013-11-28,29 (right before sun, left pic after sun) SOHO space telescope soho-going-coming

WordPress 3 (or 4) Multi-Site Installation, on Shared Hosting, Even with Existing Web Sites

Here’s how to Install WordPress 3 with the New Multi-Site Capabilities — Even if you Already Have a Website in your Hosting Account. [Updated, works on WordPress 4 through at least WP 4.5)

WordPress multi-site features let you very easily create blogs (now officially called “sites”).

You can now have multiple blogs in WordPress with much less administration of WordPress updates, plug-in updates and settings, theme updates, etc. Multiple blogs, for each domain you are hosting, can be managed by a single installation of WordPress.

I had two web sites already in my web hosting account. I wanted to keep those web site, and add multiple blogs. Specifically, I had http://www.lernerconsult.com in /public_html/, and other web sites as add-on domains.

For you to have your existing web site, and WordPress 3 with multi-site, some special adjustments will have to be made to your hosting. Multi-Site needs WordPress to be in /public_html, so you’ll want to move your web site into a folder, as an add-on domain.

I’ll walk you through:

  • Making the changes to how your hosting account is set up
  • Installing WordPress in multi-site mode
  • Installing the plugins for domain mapping, so your blogs can have the domain name you want to use
  • Using the domain mapping plugin


If you want, I can do installations for you, just Contact Me

Hosting Account Set Up

You could simply leave your existing website where it is (in /public_html), and install WordPress in the same location. Not recommended.

WordPress requires index.php for its main file. People browsing to your domain (i.e. www.yourdomain.com, no file name specified) would get your WordPress administration blog, not your web site. Oops.

You would have to rename your index.php or index.html to something else (maybe home.php or home.html). Do This Before You Install WordPress (it would overwrite any files that have the same name)!

Other files you might have that would conflict are .htaccess, robots.txt, license.txt, readme.html, so make copies of these. The other WordPress files and folders all start with wp- (for example, wp-config.php).

The folder would get cluttered with lots of WordPress files, and you would have to keep track of what files are for what.

Usually it’s a good idea to keep things separated, easier to troubleshoot, easier to maintain.

Now you Can Install in a Sub-Domain

Sometime after I wrote this, WordPress and/or the Domain Mapping plugin changed; you can now run WordPress in Multi-Site mode, installed in a subdomain or Add-on Domain with Domain Mapping working; this is much easier than moving an existing non-WordPress site. (You still can not install in a subfolder and have domain mapping work.) Whether you install WordPress in a subdomain or an add-on domain, you install WordPress Multi-Site in “subdomain mode” or “subfolder mode”. In “subdomain mode” this will have you run WordPress from, for example, http://wp.yourdomain.com/wp-admin/ and create http://site2.wp.yourdomain.com/ and http://site3.wp.yourdomain.com/ and map domains to those. Another option is to create an Add-on Domain, install WordPress in http://yourotherdomain.com, run WordPress from http://yourotherdomain.com/wp-admin/ and create sites http://site2.yourotherdomain.com or http://site3.yourotherdomain.com. You can also install WordPress either of these ways in “subfolder mode”, making sites such as http://wp.yourdomain.com/site2/ or http://yourotherdomain.com/site2/.

I recommend leaving a copy of your pre-existing web site in /public_html only long enough for changes to propagate through your hosting provider’s servers, so people are finding your web site in its new location on your web server. (DNS wouldn’t change, just the settings internal to your hosting account.)

If You Already Have An Earlier WordPress Version Installed

If you have a recent prior version of WordPress in /public_html, you can use the built-in Update feature, and then enable the multi-site features.

If the prior WordPress is in a different folder (not /public_html), leave it alone, so it is functioning as you set up WordPress 3 and learn it’s new features. Then export/import to the new version. Don’t modify the old blog until you have everything brought into the new WordPress.

Prepare Your Hosting Account for WordPress 3

If you don’t have a hosting account, or if your host can’t give you everything you need, the hosting provider I recommend is LunarPages, they match all the requirements for multi-site, have done it successfully (for Mine!) plus great technical support and low prices. I’ve been completely satisfied, for several years, with their Basic Hosting. Update: SiteGround is excellent, with top security and WordPress-specific technical support.

Hosting requirements:

  • If you were running WordPress 2.x or higher, your account probably has everything you need. But check they do security thoroughly, almost all older hosting companies are Negligent.
  • Wildcard DNS (the multi-site features require this). This is the one thing many hosts do not allow.
  • able to modify .htaccess, with mod_rewrite (so the server can modify URLs for multi-site blogs, and for better search engine links)
  • PHP (preferably PHP 5), and MySQL
  • I prefer Apache servers, they tend to cost less than Windows servers, and they are so widely used it’s easy to find answers to any questions you have.
  • Preferably allow you to host multiple domains on one account. (I suggest one domain name for WordPress, and one for your main blog using WordPress. There are some advantages to this.)

I’m giving instructions for an Apache server. There will be some differences if you are on a different type of server, primarily your files wouldn’t be in /public_html.

I’m giving instructions for a “subdomain installation”, not a “subfolder installation”. Blogs you create will have addresses like http://topic.yourdomain.com (subfolder installations would have addresses like http://yourdomain.com/topic/).

Before Installing WordPress 3 Multi-Site

Here’s what you’ll need to do, to have your existing web site(s) and blogs modified before installing or updating your WordPress installation.

DNS ChangesThese take time to spread through the Internet, so make these changes right away.

You will need (well, okay, I urge you to get) a new domain name to run WordPress next to your web site; currently .info domains are very inexpensive. This new domain name should point to your /public_html. For example, if an error in a theme prevents your site from displaying, you would really want the WordPress Admin pages working properly, using the default WordPress theme.

If you are doing like I recommend, Move your existing primary domain name so instead of pointing to /public_html it is an add-on domain. (Have your host’s technical support modify the DNS settings. They can put a place-holder domain name, if needed temporarily, for your Primary Domain for your account.)

Wildcard DNS is another change, see below. Unfortunately, you may not be able to do this until these DNS changes have taken effect. If you do this before other DNS changes, you will likely have to delete the wildcard subdomain, and re-install it.

BackupNow is a great time to back up your entire site. Use CPanel, Backups to backup your web pages. You’ll also need to back up any existing WordPress databases.

If you have a blog using a recent earlier version of WordPress, use the Tools, Export feature to make a file with your WordPress database that can easily be brought into the new WordPress. (There are also importing tools for bringing in posts from other blog software.)

Note for Version 3.0: There is a glitch with Category and Tag imports. I had, for example, a Tag “Internet Marketing” and a Category “Internet Marketing”. These had different internal names: the Tag slug was “internet-marketing”, and the Category slug was “internetmktg”. When importing, “oops, internet-marketing is taken, oops, internet-marketing-2 is taken, ah internet-marketing-3 is free. The Categories became “internet-marketing-2”, “internet-marketing-3”, “internet-marketing-4”, etc., all with the name “Internet Marketing”.

Try changing the Category Names to be UNIQUE, including unique to the Tags you have, before you export, while still being descriptive for search engines (perhaps abbreviate the tag/category you use least). Then you can change the Category Name to look better, after importing.

If you need it, there are WordPress plug-ins for helping rename categories and tags.

Have a domain name for WordPressYou should consider getting a new domain name to run WordPress next to your web site. (Unless you decide to have both on the same domain name, which I don’t recommend. For example, a bug in your custom theme could prevent you running your WordPress admin pages.) One domain for WordPress, one for your other web site domain.

The multi-site feature expect a URL like domain.com (or domain.info, domain.us, etc) or any subdomain.domain.com, but Not with any domain.com/subdirectory. (Updated, Older versions didn’t allow subdomain installation.)

Blogs will be addressed with URLs like programming.domain.com, opera.domain.com, basketball.domain.com or they can be Mapped to other “Networks” that you define, like programming.otherdomain.com, opera.thirddomain.com and basketball.otherdomain.com. [I’m not mentioning setup of “subfolder mode”, only “subdirectory mode” of WordPress. Subfolder mode works great, but I’m only giving examples in a few places.]

You have to be able to access WordPress from the Internet, even if you are using WordPress to manage blogs for other domains. Having only a “place-holder name” for the Primary Domain for the account, won’t work. (If you have a place-holder for the primary domain, you can Park your new WordPress domain, through CPanel, and that will work.)

There may be a way to have a way to make .htaccess redirects to a folder work while having the multiple-site subdomains work, but I haven’t seen it documented anywhere. Don’t try; just install WordPress in /public_html, with its own new domain name. (Update: you can now install WordPress in the root of your account, /public_html, or the root of a subdomain or Add-on domain.)

Move existing Primary domain to Add-onThe WordPress code must be installed in /public_html so the multi-site features can work. So, you’ll want to move your existing web site to a new location on the server.

(Obsolete, Subdomains or Add-on Domains work) Note: If you try installing WordPress in a subdomain, e.g. wordpress.mydomain.com, you will get errors like “Warning! Problem updating http://opera.wordpress.mydomain.com. Your server may not be able to connect to sites running on it. Error message: Couldn’t resolve host ‘opera.wordpress.mydomain.com’”.

Do not move the folders for any add-on domains, subdomains, or for your FTP users, as these must be in /public_html. (Make a list, from CPanel: Addon Domains, Subdomain, and FTP Manager.) Also leave folders that are not part of your main site (for example, if you have a folder where you are just backing up some files).

You may have to copy/move the files yourself (some hosting companies will move the files for you, some won’t). FileZilla, a very popular, free, cross-platform (Windows, OS-X, Linux) FTP program, lets you move files between folders on the server, with simply drag-and-drop, without having to download/delete-from-server/upload.

If your site isn’t busy (can be down a few minutes without much disruption to visitors), move the files. Moving them is quicker, more reliable, easier than copying. (You don’t have to worry about dropped connections interrupting a copy, and then having to verify all files copied.) Moving also should leave file dates unchanged, unlike uploading which changes dates to the upload date. So, after creating your add-on domain, move the folders for your web site to the add-on domain’s folder. Then you can copy the folders to your computer and upload them to the old locations, so they are found if needed in the old location.

Note: If your site is getting visitors, so having it be down for a while (from a few minutes, to rarely up to 3 days) won’t be acceptable, copy your files to the add-on folder, instead of moving them. Copying them to your computer and uploading them to the new folder lets your site function while the DNS changes are propagating through the Internet.

Leave the files in the original location for several days, to make sure all users are accessing the new location, and then delete them from /public_html.

Move or copy the folders and files from /public_html to the add-on domain’s folder (for example, I moved www.lernerconsult.com from /public_html to /public_html/lernerconsulting ).

After you’ve moved /public_html/cgi-bin/ you should make a new cgi-bin folder in /public_html (it’s likely expected to be there.)

Don’t move these files:

  • .htaccess since most of the settings in it belong in /public_html. You can move the lines that are specific to your add-on domain (e.g. “Redirect Permanent” lines) into a .htaccess file in the add-on folder.
  • Custom error pages. Usually there will be a 404.php (could be 404.html), and maybe also 300.php, 400.php, 401.php, 403.php, 406.php, 410.php, and 500.php). Copy these instead of moving them.

Once your existing domain name is pointing to the add-on domain, test that your web site is working.

  • Copy a test web page to the new location, with a unique name (any name that isn’t in the old location, such as test.html), so you can verify the DNS change to the new location, has spread through the Internet. Keep occasionally trying the test.html until you see it display (it may take up to two days for the changes to spread).
  • You should check that all scripts work, and all files that are Included show on your pages (for example, your site menu, or footer, or Twitter script). Unfortunately, many scripts reference specific server locations, instead of locations relative to the Site Root; those scripts would need to have the file locations adjusted, usually in a configuration file.
  • Don’t delete files from /public_html until your site is working normally, from the new location, or visitors will get errors about “missing” files.

Wildcard DNS workingMust be able to type in any non-existing sub-domain name, for the URL, and have it go to WordPress (/public_html/index.php). Set up wildcards for every add-on or parked domain in the account.

Don’t set up wildcards for your subdomains, even though it appears you could. A sub-sub-domain maps to /public_html (sanfrancisco.california.mydomain.com maps to /public_html/sanfrancisco, not to /public_html/california/sanfrancisco, so simply make sanfrancisco.mydomain.com). Other software can use this; WordPress doesn’t.

Make wildcard entries by going to Subdomains in CPanel, and enter * (asterisk) for the subdomain name. (If you don’t use CPanel, then in the DNS area of your web hosting account, add a subdomain with a value of *)

Then give it a few minutes for the change to make it’s way through your host’s servers. Test it works, by uploading a simple test html file to /public_html, and browsing to a made-up subdomain (one that has not actually been defined), for example asdf.yourdomain.com/test.html.

If you get an error message when you try browsing to the made-up subdomain, such as “Oops! Firefox could not find asdf.lernerconsult.com“, then the wildcard DNS change hasn’t reached your host’s other servers yet.

Note: when I changed my “primary domain” on my hosting account, all my subdomain entries had to be re-done, including the wildcard subdomains. Delete the subdomain entries (doesn’t delete the files, just the pointer) using Subdomains in CPanel, and re-create them. You won’t be able to delete “subdomains” that are for your add-on domains, even though they show here.

Note: Some web hosting companies don’t have CPanel set up to allow Wildcard DNS through the Subdomains page. Those companies will require changes made manually, by technical support. One page that explains how to do it is http://ma.tt/2003/10/wildcard-dns-and-sub-domains/

Other hosting companies won’t allow wildcard DNS at all. Switch to another host, if you want multiple blogs. LunarPages is great, SiteGround is excellent, and has technical support that knows WordPress even at the level of troubleshooting plugin issues.

If you are on a VPS or dedicated account, you also need a wildcard record in the vhost entry for that web account. This is in the etc/conf/httpd/httpd.conf file in Apache: ServerAlias *.yourdomain.com.

Single-Site Until Wildcards are ReadyDon’t try to install WordPress Multi-Site features until the domain name for it is working, and the Wildcard DNS (for at least the domain you’re using for WordPress) is working. WordPress will work for single blogs, but the multi-site features won’t work without these working.
PHP 5Some plug-ins require PHP 5, and give errors without it. Example: Parse error: syntax error, unexpected '=', expecting ')' in /home/username/public_html/wp-content/plugins/bubblecast-video-plugin/bubblecast_utils.php on line 264

Turn on PHP5 using CPanel, PHP, or by editing your your /public_html/.htaccess (notice the leading period in that file name). Copy this text (the lines wrap, 2 lines, starting with AddHandler and with AddType):
AddHandler application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml

Update Other System FilesUpdate /public_html/robots.txt, adding these lines:
# WordPress
Disallow: /wp-admin
Disallow: /wp-includes
Disallow: /wp-content/plugins
Disallow: /wp-content/cache
Disallow: /wp-content/themes
Disallow: /category/*/*
Disallow: /comments
Disallow: */comments
Disallow: /feed
Disallow: */feed
Disallow: /manager
Disallow: /trackback
Disallow: */trackback
Allow: /wp-content/uploads

Upgrading WordPress (if you Do have WordPress 2.7 or higher installed)

If you are upgrading from version 2.7 or higher, you can use the automatic upgrader. This will upgrade you to version 3 in single-site (one blog) mode. See below for configuring multi-site mode. Open /wp-admin/update-core.php in your browser and follow the instructions. If you have an existing WordPress blog, you can use the same Database, but give a different table prefix than the default wp_, for example I used wp3_. Fill in the database connection information from your other blog’s wp-config.php.

Installing WordPress Files (if you Do Not have WordPress version 2.7 or higher installed)

If your web host has WordPress 3 installation through Fantastico, or other single-click installation, do that. If not, download WordPress 3 files. Unzip them to a folder on your computer. Edit the files shown below, in “WordPress Configuration for Multi-Site”. Then upload the files to your web hosting account, in the the folder where you would put your main web site, the /public_html folder.

Use the standard installation instructions, to get WordPress installed (in single site mode). These are in the readme.html file that comes with the WordPress installation files, or online there is a handy guide.

Find out your database connection information, from CPanel Databases, or from your website hosting provider.

You can install your favorite themes and plug-ins. Most themes and plug-ins for WordPress 2.9x work just fine in WordPress 3.0.

You will have to disable all plug-ins to turn on Multi-Site, so you may want to wait till later to install tons of plug-ins (Note: hopefully WordPress will have a way to automatically disable plug-ins, as you are enabling Multi-Site, and then “Restore All Enabled Plug-ins”, but not as of the last pre-release version when I installed mine.)

Make sure you are able to log in, add a post, configure plug-ins, (in other words, that WordPress is functioning), before trying to switch on Multi-Site.

WordPress Configuration for Multi-Site

Enable Multi-SiteEven if your web hosting provider has Fantastico or another way to automatically install WordPress 3, you will have to modify some of the files to enable Multi-Site.

Edit your /public_html/wp-config.php file, adding this line:

define('WP_ALLOW_MULTISITE', true);

The recommended place is above the line: /* That's all, stop editing! Happy blogging. */ You will now see additional menu items.

Update system filesGo to the Tools menu, click Network. Follow what WordPress says to do, for editing some system files. I picked subdomain installation, since I have several unrelated domain names. (Was not clear whether I could use subfolder installation with unrelated domains.)

Give the domain name that is mapped to your /public_html, without “http://www” (e.g. lernerconsulting.info).

Path to current site is /

Edit your .htaccess and wp-config.php files as WordPress instructs you to.

Install Multiple Site and Domain Mapping PluginsI used theses plugins to map domain names to WordPress:

Other Multi-Site plugins I’m using:

  • (Obsolete, hasn’t been updated, do not use ancient plugins) Multipost MU: Allow a WordPress multi-site administrator to duplicate individual posts or pages to multiple blogs at once. Gives checkboxes on your edit screen, specifying which other blogs to publish on.
  • WPMU Global Search: Adds the ability to search through blogs into your WordPress 3 installation.
  • YD WPMU Site-wide options: Makes selected WPMU plugin settings site-wide. Change to a setting of your main blog can now be automatically replicated to all blogs. Centralized management of your plugin options. Try it, see if it’s helpful or not for you. There are a bewildering number of options, displayed with their WordPress-Internal names (not what the plug-ins would display on screen), so you likely will not know what some of these are for…
Install WordPress MU Domain Mapping, currently Version 0.5.4.2This plugin can not be installed by using only the WordPress plugin installer; there are steps you must do manually.

Install the plugin in the usual way into the regular WordPress plugins folder. (My Sites, Network Admin, Dashboard, then Plugins, Add New. Search Term: domain mapping. Find “WordPress MU Domain Mapping”, in the description it will say “By Donncha O Caoimh.” Click “Install Now”.

Move sunrise.php from /public_html/wp-content/plugins/wordpress-mu-domain-mapping to /public_html/wp-content/ . (If there is a sunrise.php there already, from another plugin, you’ll just have to merge them as best you can.)

Edit /public_html/wp-config.php and uncomment or add the SUNRISE definition line. If it does not exist please ensure it’s on the line above the last “require_once” command.
define( 'SUNRISE', 'on' );

Move domain_mapping.php from /public_html/wp-content/plugins/wordpress-mu-domain-mapping/ to /public_html/wp-content/mu-plugins/ (create that folder if needed). [Note: The plugin’s readme.txt says to ignore this instruction in the Domain Mapping Tutorial written by a user, but I did and it is working.]

Note: Moving domain_mapping.php means that in Plugins, Installed Plugins, you will not find the plugin in the main plugins list, which is good; you don’t want to ever disable it. Click “Must-Use” at the top of the screen to see it.

Note: The plugin readme.txt talks about setting ANAME and CNAME records.

If you are installing on your own server, having to configure your own DNS, follow these instructions (or the more detailed instructions in the OttoPress link).

If you are installing on a shared hosting account, most shared hosting providers don’t give you access to setting ANAME or CNAME records; your hosting provider will do it for you, or you do the equivalent by going into CPanel and Add-On Domains.

Domain Mapping Plugin settingsYou should now have a new main menu item, My Sites, Network Admin. In My Sites, Network Admin go to Settings, Domain Mapping [before version 3.2: Super Admin, Domain Mapping].

In the Domain Mapping Configuration section of the screen, set the Server CNAME domain to the domain pointing to your /public_html, without leading http://www. (for example, lernerconsulting.info). Or, instead of the CNAME, set the Server IP Address or IP addresses (comma deliminated) of your server.

In the Domain Options section, I have Permanent redirect checked, User domain mapping page checked, and others unchecked.

Test It WorksDon’t do any more for Mapping domains now. (I have a separate blog post for exactly how to do WordPress 3 Multi-Site Domain Mapping.)

You should now have WordPress working with multiple sites. Try picking a topic you want to blog about, go to My Sites (at the top of the screen), Network Admin, Sites (alternatively, type yourtopic.yourdomain.com in a web browser). If WordPress is working properly, you will get a screen to create a new blog.

Importing Your Posts from Earlier Version of WordPress

You did the step “Backup” above, right?

See the comment in Backup (above) about Category and Tag names glitch in WordPress 3. Then in WordPress, do a Tools, Import.

Please leave your questions or comments.


by

Comments

6 responses to “WordPress 3 (or 4) Multi-Site Installation, on Shared Hosting, Even with Existing Web Sites”

  1. glerner Avatar

    Just updated this to include the WordPress menu changes (at version 3.2), and expanded converting WordPress to Multi-Site and installing the Domain Mapping plugin.

  2. glerner Avatar

    From andrea on http://wpmututorials.com/basics/everything-you-wanted-to-know-about-creating-a-network-of-multiple-sites-in-3-0/

    “If the forums at your host say it’s not supported [wildcard DNS], then … Pick the subfolder option instead, which doesn’t use the wildcards.”

    Answering if you can install WP3 in a sub-folder, and then create subdomains specifying /public_html/folder_name, she says: “Correct, BUT the Apache directive for the wildcard would also need to be pointing to the same place. On shared hosts, they don’t let you do that.”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.