Blog

3 Steps to Managing Multiple Domains with WordPress!

Here is a very boring article on how to manage multiple domains using WordPress 3.0.1. Read it only if you have got insomnia (and want to get rid of it fast). ;)

Perhaps you already know that you can setup "multiple blogs" with the new version of WordPress. You can setup the sites either in a "subfolder" or "sub domain" format. But did you know that you can manage totally separate websites with just one installation? I am talking about managing different top-level domains. :D

Things to keep in mind:

1. The sites you host on WordPress would NOT have a "normal physical existence" on the server; rather they would exist only in the WordPress database.   If you are well-acquainted with the concept of "virtual hosts on Apache" then you know what I mean here! ;)

2. WordPress 3.x sucks quite a bit more RAM than its predecessors. WordPress 3.0 was notorious for sucking as much as 256 MB of RAM, but I hope that the issue has been fixed in the new version. Still, you will need quite a bit of memory to run it. To give you an idea, I have only two "no content, no traffic" sites hosted on WordPress and that alone accounts for a memory usage of 19-21 MB. :D For reasons of disclosure I would also like to mention that I am using the free semiologic theme (my fav) as well as around 40 plugins, of which 15 are "shared" and 2 are "compulsory". I would mention some of the plugins later in this article! ;)

In short, I would really suggest that you go with a VPS (at the very least) if you want to try out the "multisite" feature of WordPress, otherwise version 2.9.2 should be more than enough to meet the needs of a regular WordPress user! :)

3. Even though all the sites would be hosted on the same database, you would still need to go to the backend of each site to manage it – for example, configuring plugin settings, posting articles, etc.  In short, even though they are hosted under the same environment, they would behave like totally separate websites. If you configure the sites correctly, the search engines would also treat them as different sites, rather than part of a single site.

4. For best results, you should install WordPress in the root of your server, e.g., under the "public_html" folder. I am not sure if my instructions would work for an addon domain install, because honestly I have never tried it that way!

5. Lastly of course, if you are on a shared host your webhost has to support it. Some do, some don’t. With a VPS of course you are free to configure the server the way YOU want. :D

Okay, now enough of rambling. Let us get on to the meat! :)

Step 1: Web Hosting configuration:

That are some adjustments you need to do (or ask your web host to do them for you) on your server. Please note that the adjustments I list here would work only for "subdomain" installs, which I believe is a better option than subfolders anyway! Also you must be using Cpanel™; no I don’t believe that is the best one out there but that is just what I am acquainted with, so if you use something different, this tutorial may not make much sense to you. ;)

a) Ask your webhost if they support "Wildcard DNS subdomains" and if they do, ask them to enable it for your server/account.

If you would like to use the "subfolder" install instead, ask your host if they support "mod_rewrite". Most webhosts support it anyway!

b) Next, you would need to add a wildcard entry to the DNS settings of the main domain where WordPress is installed. So, log into the WHM of your server (if you don’t have access to the WHM…well you know what to do-bug your host hard to do it for you! :D ), then go to "DNS Functions >> Edit DNS Zone"!

From the list, select the domain name where WordPress is installed, and click "Edit". Scroll down until you find the line "Add New Entries Below this Line." You would find several empty boxes. :D Here, add the following:

-Under the "Domain" column, add an asterisk: "*".
-Under the "TTL" box, enter "14400"
-The third box should contain "IN"
-In the fourth box, select "A"
-In the fifth box, enter the IP address of your server!

Please note that all the websites you are going to host on WordPress should share the same IP address as well as nameservers! BTW, this is not something you need to worry about at all unless you use multiple custom nameservers like me. :D

c) Next you would need to add a ServerAlias entry in the httpd.conf file of your server! The steps to follow are:

-Login to your server using SSH (if you don’t have a SSH client use the free Putty)
-cd /etc/httpd/conf/
-open httpd.conf in an editor
-Find the entry for "domain.com" (the domain where WordPress is installed)
-Add an entry ServerAlias *.domain.com domain.com
-Restart the httpd service

Now I don’t use SSH at all because I am not very well-acquainted with it. These instructions are what my webhost gave me, and I pasted them here "as is". ;) If you at a FTP guy, you can find the file under /usr/local/apache/conf. Of course you need to have root access to the server in order to access that file. ;)

Better yet, why not cajole your host into doing this for you; I know I did! ;)  

"Oh Arindam, I am almost bored to death after reading so far; got a headache too; I guess I got to go to bed!"

Well, I told you so ;) But cheer up because you have completed the hardest step in the series. Now we are on to better and interesting things. ;)

d) Okay, from here on I would say maindomain.com to denote the domain where WordPress is installed, and domain2.com to denote the second domain you are going to add into the WordPress network. I hope that is okay! :)

First, log into the Cpanel of maindomain.com, then click on "Files=>Backups=>Databases" and download a backup of your SQL database (the one used by WordPress)! This is not an essential part of the job but a much-needed precaution! Next, click on "Domains=>Parked Domains" and add domain2.com there as a parked domain. Once done, you should see domain2.com added to the list of parked domains; also under the "Redirect to" column, you should see "not redirected". Perfect! :)

Step 2: WordPress Network configuration:

a) Download a backup of all the WordPress files on to your local hard drive. Again, this is not an indispensable part of the process but would help you in case something goes terribly wrong with your blog!

b) Next, edit the "wp-config.php" file with PSPAD and just below the line "define(‘WP_DEBUG’, false);" add this line:

define(‘WP_ALLOW_MULTISITE’, true);

Save it and upload the file back to your server!

c) Next, you should increase the memory limit of WordPress too (this is the perfect time to do it). Go to "wp-includes" folder and edit the "default-constants.php" file with PSPAD. In that file, locate this line (about line number 21):

if( is_multisite() ) {
                             define(‘WP_MEMORY_LIMIT’, ’64M’);
         
Assuming that you are managing a mutisite install (why else would you read this boring article ;) ) and that your max PHP memory limit is about 150 MB, you can change that "64" value to "128" (that is what I have set mine) or anything else you prefer! If you don’t know about the PHP memory limit of your server, you should contact your host and get that info!

d) Login to WordPress. You should see some a menu now -"Tools=>Network"! Click to go to the network.

e) You would be given two choices here: either subfolders or subdomains. I chose "subdomains". Please be sure that you are choosing what you really want, as changing this option later on maybe quite difficult, if not possible.  ;)

There are some scenarios described here where you may be given just one choice instead of two!

You would be offered with two text boxes full of codes: one should be copied to your site’s .htaccess file, and the other to your blog’s wp-config.php file, but not before removing that define(‘WP_ALLOW_MULTISITE’, true); line from the wp-config.php file first! :D

Also create two folders called "blogs.dir" and "mu-plugins" under the "wp-content" and CHMOD them both to 755. If you don’t know what CHMOD means, you can read my very boring FTP tutorial! ;)

f) Login to WordPress. Congrats, you have just been promoted to "Super Admin"! :D.

g) Click on "MY Sites=>Add New" to add a new subdomain site to WordPress database.

In the "Site Address" box, enter: domain2.mainblog.com

The next two boxes are self-explanatory. If you want to be the admin of both sites you should enter the same admin email as the one you entered when installing WordPress on maindomain.com!

Note down the site ID of your new site! It will come handy for your next big step!

Okay, we are done…well, not yet. ;)

Step 3: Domain Mapping Plugin configuration:

a) First download the domain mapping plugin. Upload the "domain-mapping.php" file to "mu-plugins" directory, and the "sunrise.php" file to the "wp-content" directory!

b) Next, edit the "wp-config.php" file with PSPAD and just below the line "define( ‘BLOG_ID_CURRENT_SITE’, 1 );" add this line:

define( ‘SUNRISE’, ‘on’ );

Save the file and upload it back to the server!

c) Next, click on to "Super Admin=>Domain Mapping". Once there, enter the IP address of your server in the first box; ignore the next box! As for the next four options, I have set it in the following way (but your preferences may differ from mine):

-Remote Login=>UNCHECKED (for security reasons)

-Permanent redirect (better for your blogger’s pagerank) =>CHECKED

-User domain mapping page=>CHECKED

-Redirect administration pages to site’s original domain (remote login disabled if redirect disabled)=>CHECKED

d) Now click on "Super Admin=>Domains" to add a new domain. Once there, type the site ID of the subdomain site that you added earlier, and in the next box enter "domain2.com". Leave the "Primary" option CHECKED!

I made a mistake by unchecking this box because I thought that the new domain I was adding is NOT the primary domain on the server. Well that mistake cost me hours. :P

e) Okay, click on "MY Sites" and login to the dashboard of domain2.com.

f) Once there, click on "Tools=>Domain Mapping". There, under "Active domains on this blog", you would be offered the option to set the primary domain for your blog. The options would be:

domain2.com
domain2.mainblog.com

Obviously you will select the first option as the primary domain for your blog! :) Now every time you try to visit domain2.maindomain.com you would get redirected to domain2.com. ;)

Of course, if you have remote login disabled, then you would get redirected to domain2.maindomain.com/wp-admin every time you want to access the dashboard of domain2.com. :)

I hope everything is clear thus far! The process is so involved that I just hope I am not missing something here, LOL.

Further reading:

Using multiple Domains with WordPress MU
Wildcard DNS and Sub Domains
Wildcard Subdomains
How to Use WordPress 3.0 Multisite for a Blog Network
WordPress 3.0 and Domain Mapping
Wildcard Catch-all Subdomains (a basic tutorial on mod-rewrite and wildcard subdomains; a MUST-READ whether or not you use WordPress)

I think I promised you something else…oh, the plugins! Okay, here is a list of the plugins I am current using on that multisite blog (just the list okay? Already you are so bored! :D ):

Advertising Manager (Personally I don’t like the interface of the new version of this plugin, especially the "Edit" section, but figured out that that my favorite version won’t work under a multisite environment, so had to bite the bullet :(  )

Akismet (must-use plugin; I dropped both the files – akismet.php and akismet.gif – individually – in the mu-plugins folder; DO NOT drop the entire "akismet" folder there or the plugin won’t work!)

Autolink URI (activated across the network)
Bad Behavior (activated across the network)
Cleverness To-Do List
Comment License
Comment Rating
Contact Commenter (if the admin privately replies to a commenter, that reply is also BCC-ed to the admin; no idea why)

CryptX
Exec-PHP
Executable PHP widget
Fast and Secure Contact Form
FeedBurner FeedSmith
Frame Buster (activated across the network)
Gurken Subscribe to Comments
Highlight Comments
My Brand Login (activated across the network)
No Curly Quotes (activated across the network)
Official StatCounter Plugin
Ozh’ Absolute Comments
Pretty Link
Redirection (activated across the network; if it redirects your blog homepage to a non-existent page, just enter the homepage URL (without "www"), select "URL only" from the next box and "Do nothing" from the third box; this should fix the issue)

Remove Links in Comments
SABRE (a MUST-HAVE plugin whether or not you allow user-registrations on your blog, because it stops the bot registrations nonetheless!)
 
SEO Ultimate (activated across the network; the 404 monitor module of the plugin maybe particularly annoying to some; you may want to disable it after a certain time)

Silence Is Golden Guard (activated across the network)
Simple Trackback Validation
Target Blank In Posts And Comments (activated across the network; if you want to use this plugin please do read my note regarding it here)

TweetMeme Retweet Button (activated across the network)
WP-Ban (activated across the network)

WP Facebook Like (activated across the network; if you have selected to automatically insert it in your blog posts and pages, and if you are also using the Tweetmeme plugin with the same settings, I recommend putting Tweetmeme button at the top and the Facebook Like button at the bottom of your posts/pages, or vice versa; otherwise either of the buttons may not show up properly)

WP Overview (lite) MU (activated across the network)
What Would Seth Godin Do

WP-DBManager (because the database manages a network of blogs rather than an individual blog, I have set the plugin to backup the database every 8 hours! Ha! Call me crazy! ;) ; while the plugin page does not mention that it is compatible with WP 3.x, I am using it on my multisite without any issues so far; IMO it is not necessary to activate it anywhere else other than the main blog, because if you look through the database backup file generated by the plugin, you would notice that it backs up the data of the entire network, not just the one where it is activated!)

WP-ShortStat
WP-Table Reloaded
WP-UserOnline
Yet Another Related Posts Plugin

If a plugin is not activated across the whole network, it is either because I need the plugin only for a specific blog, or that the plugin does not support a "multisite" environment fully and thus needs to be activated locally. Depending on your individual needs, you may or may not need all the plugins mentioned above!

Two plugins need special mention here:

a) WP Overview (lite) MU: This plugin would show you the total memory usage by the entire network of blogs. Useful if you are on a shared hosting environment! :)

b) Akismet: If you want to activate the API key of akismet across the entire network instead of having to enter the key manually for each blog, just edit the "akismet.php" file with PSPAD. Below the line "define(‘AKISMET_VERSION’, ‘2.3.0’);", add this line:

define(‘WPCOM_API_KEY’,’YOURKEYHERE’);

Replace "YOURKEYHERE" with YOUR API key! This should effectively enable Akismet across the whole network and hide the Akismet configuration screen for all blogs! :)

Now there is a reason why I bored you so much – I need a nice comment! :) Please click here to post a nice comment, thanks! :D

Disclosure: ArindamChakraborty.com is affiliated to Knownhost!

21 Comments

  1. Tweets that mention 3 Steps to Managing Multiple Domains with Wordpress! -- Topsy.com

    […] This post was mentioned on Twitter by Renee Benzaim and Renee Benzaim, Renee Benzaim. Renee Benzaim said: RT @arindamc 3 Steps to Managing Multiple Domains with WordPress! http://bit.ly/baZY1e #im #seo #wordpress […]

  2. Cooking Tips

    ZZZZZZZZZZZZZZZZZZZ….Huh, what…..sorry , I was napping :-)

    Hey thanks for the complete process to set up multiple domains with WordPress. I really though it would be harder.

    Brian Ankner

  3. Steve

    G-day Nutty
    excellent post again, lots of good info but if get that right first time, would be a miracle. LOL

  4. Amelia

    Thanks for that, I love reading your articles I learn so much and it shapes my actions and online activities to be so much more efficient. I finally feel like I’m getting somewhere, Truly thanks again :)

  5. Forest

    I was really pleased when WordPress announced this but a little confused when I found out they made it so technical to get working…. I am yet to try it but this looks like a perfect guide to getting it working.

  6. Emma

    Hi Arindam,
    I’ve just converted my blog from Blogger to WordPress and choosing the right plugins is an absolute minefield. Whilst only wanting one blog for now (!), your plugin list has made interesting reading.
    Thanks!
    Emma
    p.s. Please don’t keep referring to your posts as ‘boring’ – they’re not, and a little positive thinking goes a long way :)

    1. Arindam

      Hi Emma,

      Welcome back (after a long time??). :D

      >>Please don’t keep referring to your posts as ‘boring’ – they’re not, and a little positive thinking goes a long way

      Actually a friend and regular reader privately told me she was bored only this time coz she did not understand what I am saying here. I guess it must be way too technical for her! ;)

  7. Lotus

    Thanks for nice list of wordpress plugin list. I really like the ability to so easily create subdomains in WordPress MU.

  8. Justin

    I am bored. I did not understand a word you said. If this works on sub domains did I read right it will not work on addon domains? and do you have to MU and what does MU stand for? Multi Use?

    I have put up several blogs on the addon side of things and using a somewhat complicated Theme that does a lot of things. FlexSqueeze. I looked at yours. How do you monetize it with adsense? or can you?

    I kinda like it, as it seem simple enough, is it?

    Thanks for the kind info. Maybe after I wake up and yawn a couple of times I can digest it better.

    Justin

  9. Justin

    While I have your attention. I think I asked once, but I slept once since then. Is there a difference in the way the search engines look at a site rating in subdomains and addon domains?

    I put one addon up about a week ago (the one above) and it is indexed but no where to be found up to first 500 showings and that is with extensive pinging and social posting and even some articles floating round out there that rate well on searches.
    Thanks, Justin

    1. Arindam

      @Justin,

      >> If this works on sub domains did I read right it will not work on add-on domains?

      It WILL work on addon domains and that IS exactly what this article discusses! ;) You just need to “park” the domains u want to add (instead of adding them as “add-on” domains) as I mentioned in this article. :)

      >>and do you have to MU and what does MU stand for? Multi Use?

      The current WordPress is MU anyway. This article is for wp 3.0.1. If u don’t want to use MU, u can go back to wp 2.9.2 :)

      >>How do you monetize it with Adsense? or can you?

      Use advertising manager plugin. ;)
      http://wordpress.org/extend/plugins/advertising-manager/

      >> Is there a difference in the way the search engines look at a site rating in sub domains and add-on domains?

      Add-on domains are same as domains; the only difference is the way you add them to ur server, otherwise they function just the same. For example: flexiblewriter.com is a domain, but fatlossplr.com is an addon domain. :) Sub-domains r basically assistants of the domains :)

      I have a couple of seo articles on this (maybe that is the question u wanted to ask):

      http://flexiblewriter.com/search-engine-optimization-demystified-part-1
      http://flexiblewriter.com/google-treats-sub-domains-differently-here-is-how

      >>I put one addon up about a week ago (the one above) and it is indexed but no where to be found up to first 500 showings and that is with extensive pinging and social posting and even some articles floating round out there that rate well on searches.

      Backlinks my friend, build 500 backlinks ;-) (kidding, but u need backlinks for getting ranked high in SEs, anyway)

      U can choose not to do pinging, u can choose not to do rss directory submissions, u can choose not to do any article marketing…

      But backlinks r a MUST! And QUALITY backlinks at that!

  10. Justin

    Thanks, now to get this straight, I can park my Sub-domains and they act just like domains. If they are already active as
    subdomain.domain.com I can park them and they will work as
    subdomain.com. No?

    I know, I am dense a box of rocks. :)

    1. Arindam

      >> I can park my Sub-domains and they act just like domains.

      NO u cannot. U can park domains, NOT sub-domains.

      Hmm, maybe u can do a bit better by reading the definitions LOL:

      http://docs.cpanel.net/twiki/bin/view/11_24/CpanelDocs/CpanelDomains

      On another note this article is about managing multiple top-level DOMAINS with wordpress. If you want to create just sub-domains then that is rather easier:

      http://codex.wordpress.org/Create_A_Network

  11. Justin

    I guess I had a brain fart there, I had confused Sub domains with Add-on domains. I even went to check a bit ago and see if I had been doing my Subs in the Addon box. I don’t suppose it would work, but I was spooked a bit ago and thought maybe I was doing just that. I’ll be reading your links. Thanks for the help.

    I was using confusing addon domains with subdomain and subdomains with subfolders when I asked the above question.

    SO I guess the question do subdomains rank better than subfolders. Does that clear the mud a bit :)?

    1. Arindam

      >>do subdomains rank better than subfolders. Does that clear the mud a bit :)?

      With backlinks u can make anything rank. ;)

  12. Justin

    thanks that quick comeback. Can you point me to some network information so I an maybe get up to speed on that as for the good purpose for it. I guess there is or you would not have written this post. ;).

    Thanks

    1. Arindam

      >>Can you point me to some network information

      Sorry I did not quite get you. Does your question relate to wordpress or backlinks? ;)

  13. Justin

    I am using wordpress on most of the sub’s. I guess it would only be able to network them if they are wordpress. Is there an advantage to doing a network with them?

  14. Arindam

    >>Is there an advantage to doing a network with them?

    Well the advantage is that u can manage multiple blogs (they can be installed either in subfolders, subdomains or domains) from within a single blog. Imagine managing 100 individual blogs, their themes, plugins, etc, and compare that with managing all those 100 blogs from within a single blog. The advantage is basically “centralization” and “time saving”. Of course the “centralization” is only partial as you would still need to go into each individual blog to write posts for that blog, as I indicated in this article. ;) If you have no issue doing what u r already doing then why try to fix anything that isn’t broken yet? :)

    My 2 cents anyway.

  15. Rob

    I have successfully enabled multisite, installed MU Domain Mapping and added a second site mapped to a new domain. Everything is working fine, but I have a question about privacy:

    My original site is my business site and the new site is entirely personal, and supposed to be anonymous. However, when you watch the browser’s (firefox) path to the new site while it loads (in the address bar at the bottom), you can see it hit the original site address just before the plugin maps it to the new site domain. Occasionally when the servers are busy you can see “waiting for originalsite.com” before it gets mapped.

    Is there any way to keep visitors to the new site from ever seeing the address of the original site?

    1. Arindam

      >>Is there any way to keep visitors to the new site from ever seeing the address of the original site?

      I found this post on WP support forums. Thought it might help:

      http://wordpress.org/support/topic/wordpress-30-and-domain-mapping#post-1473701