Enable WordPress Multisite with Subdomains (HostGator)

After a bit of tinkering I have gotten WordPress multisite to work on a HostGator server setup. I am running WordPress 3.0 RC3.

After some simple editing on the wp-config.php file and the .htaccess file I added a wildcard DNS by adding a subdomain with just an asterix * and that allows WordPress to create the subdomains for multisite. Here is how to get it to work…

Step 1

Login to cPanel (something like .com/cpanel ) Go to subdomains and add one with just an asterix.

2011 04 06 1039 Enable WordPress Multisite with Subdomains (HostGator)

Step 2

Add this into wp-config.php to enable multisite.

define('WP_ALLOW_MULTISITE', true);

Step 3

Login to your WordPress dashboard and go to Tools>>Network (.com/wp-admin/network.php) You will then see the following type of instructions.

Step 4

Add a directory named blogs.dir to the wp-content directory. It should look like /public_html/wp-content/blogs.dir

The CHMOD write permissions should be something like 755 to allow the server to write to the directory.

Step 5

Add what they tell you to add into the wp-config.php file

Mine looked like this:

define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', true );
$base = '/';
define( 'DOMAIN_CURRENT_SITE', 'limecuda.com' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );

Make sure that SUBDOMAIN_INSTALL is set at true.

Step 6

Add what they tell you to add into the .htaccess file.

Mine looked like this:

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]

Step 7

I don’t know. Go start adding some sites on to your install. :)

Any questions?

Further Reading

Tags: , , ,

32 Responses to “Enable WordPress Multisite with Subdomains (HostGator)”

  1. Todd Lohenry July 9, 2010 at 11:17 am #

    I’ve done all this, but I’m not having any luck mapping domains to the ‘child’ sites I create. Any input?

  2. Poor Uncle October 29, 2010 at 11:06 pm #

    I have a “baby plan” with Hostgator. I created a main domain (the name that created the Hostgator account), plus 10 “add-on” domains, and installed WordPress on each of them. I point my godaddy domains to Hostgator’s name servers (DNS), and I am in business.

    Now, instead of installing wordpress to each of my 11 websites. I only want to install it to the main one, and then enabling wordpress multisite to manage all of them.

    My question: Do I need to remove (undo) the 10 “add-on” domains before I attempt to enabling wordpress multisite?

    • Blake Imeson October 30, 2010 at 9:00 am #

      Yes, you should remove them and then you will need to add a * as a subdomain to act as the wildcard for WordPress to create those sites.

  3. Ronnie March 17, 2011 at 5:15 am #

    Hi,

    I have a dedi server with Hostgator. I have done all the steps as above. The site descargarpelicula.net resolves fine…but then after sometime just stops, and is only accessable via descargarpelicula.clickmember.net

    If I delete the addon domain for descargarepelica.net it works for about 2 hours and then stops. When I add the “addon” domain back it works again…but also for about 2 hours.

    Whats going on?

    Thanks for the info!

    p.s. the image at Step 1 isn’t working…

    • Blake Imeson March 17, 2011 at 8:43 am #

      I would get on live chat with HostGator and see what they tell you. That is very buggy.

      Thanks for the heads-up on the image. I seem to have just lost a bunch of images inexplicably :(

  4. Ewergren April 6, 2011 at 9:30 am #

    Which HostGator plan are you using? Will this work on hatchling or baby?

  5. Ewergren April 6, 2011 at 9:30 am #

    Oh and that image is still not working.

  6. Blake Imeson April 6, 2011 at 10:42 am #

    @Ewergren I have a reseller account with them but any of their plans should do this.

    I also replace the image. Thanks.

    • Paulo August 23, 2013 at 3:21 pm #

      Blake, I also have a reseller account with them, and I’m trying to set up multisite on a domain (not the account domain). Why wouldn’t it work?

  7. Michael July 1, 2011 at 1:03 pm #

    In hostgator’s baby plan, when an addon domain is created using the cPanel, cPanel automatically also creates a subdomain (addondomain.primarydomain.com) in addition to the independent addondomain.com, (it looks like the extra subdomain ie. addondomain.primarydomain.com just to function like to ‘bridge’ user access to the addon domain that located at the root of the primary domain public_html but as an independent domain), so, if I install ‘WP 3.0 multisite’ on my primary site and another independent ‘single WP 3.0′ on my addon domain site, while when I follow above, I also would have an (asterix)*.primarydomain.com subdomain, will both my multisite WP installed on my primarydomain.com and it related virtual subdomain sites, and independent single WP on my addondomain.com function well? And the (asterix) *.primarydomain.com will not harm/mess up the single independent WP 3.0 installed on my addondomain.com ?

    • Blake Imeson July 7, 2011 at 1:50 pm #

      @Michael that sounds pretty complicated and I don’t know offhand without testing. I would imagine it would be fine as long as one of the subdomains created by multisite isn’t named the same as the addon domain. If this is a potential issue then when cPanel is creating the subdomain/directory that foes in the root I would suggest adding some random characters into it.

    • Tore December 3, 2011 at 1:34 pm #

      I had the same problem. I first tried installing wordpress network on an addon domain but I couldn’t get it to work. So i tried it using the primary domain and it worked.

      Having a network on the primarydomain, using a *.primarydomain.com wildcard won’t affect your regular blogs (or sites) that are added in hostgator.

  8. shawn sandy July 20, 2011 at 6:09 pm #

    Note: When creating the wildcard subdomain for addon domains STEP 1. you need to add the correct document root path
    eg: public_html/yoursubdomain.com/

  9. Sharon August 2, 2011 at 10:10 pm #

    I just started using Multisite today. I am having issues creating new sites. It creates some of them, like “test.mydomain.com” but not others (for example, “testblog.mydomain.com”). I removed the banned signup words, so I don’t know what is preventing any site I create from working. All it shows is a “Problem loading page” error (in Firefox) for certain domains I try to make. Do you know why this is happening?

    I’m on hostgator’s baby plan with WordPress 3.1.4

  10. Brian February 4, 2012 at 9:48 pm #

    Have you had luck setting up DNS A records or CNAME so that an external website domain will redirect to your WP multisite? Hostgator seems to use an ip+username setup (ex 123.123.123.123/~username) so DNS A records won’t work (since they seem to only allow the IP address and not the /~username part. All redirects to Hostgator seems to end up pointing to a strange landing page which I cannot figure out (you can see what I mean at this one I’m trying to get working http://www.isoleaf.net/). I’m pretty sure it’s a HostGator issue because I’m having the same problem for all domains I have hosted on several different providers (e.g. godaddy, hostmonster, etc). Just curious if anyone has gotten it working using HostGator. Thanks.

  11. lynn April 30, 2012 at 9:25 am #

    Thanks, for this post. This was the exact solution that I needed for my multisite. Moved from another host to Hostgator and all my sub sites seemed to disappear. Put in the wildcard subdomain and they are back.

    Thank you

  12. wantei June 13, 2012 at 12:41 pm #

    The sub-domain is appearing is http://wanani.me/forum instead of http://forum.wanani.me

  13. Bob Allen August 4, 2012 at 12:28 pm #

    I have installed the multisite directions to my Hostgator site about five times and cannot get the “Network Admin” link to appear. I have contacted the techs who are telling me that the Hostgator WordPress does not do multisite work. They were really no help in this. I have deleted and reinstalled the program many times and still no link to Network Admin. Can you help or is the link not really needed. I have followed the directions in the email above and get the same results.

    I eagerly await your reply,
    Bob Allen

  14. Brian November 16, 2012 at 7:42 am #

    Hi Blake. I have done all you stated and still cannot get past creating the multisites on http://christhub.com.. After they are created and I try to access, the pages just will not load. These are the dashboard page and the home page (view). Any ideas? BTW, I have a Baby Plan with HostGator.

    • Blake Imeson November 16, 2012 at 9:37 am #

      I’m frankly not sure, I’d probably just Google around for answer. Wish I had some idea.

  15. lia December 19, 2012 at 4:47 am #

    hello blake,no luck for me
    i have reseller package from hostgator and i already followed everything to make multisite works, but still no luck
    every time i create new site (using subdomain) then it doesn’t work, can u suggest me what should i do?

  16. Rohit December 19, 2012 at 11:06 pm #

    Thanks for this wonderful tutorial. I tried implementing this a long time back from now, but I couldn’t get it to work. But after reading your article, I was able to get it done in 5 minutes flat.

    Thanks a LOT!!

  17. Steve December 28, 2012 at 11:49 am #

    Great document Blake. Helped me out immensely in setting up my first WP Multisite.

    I did ran into some of the same problems I see above in getting Multisite to work on my Hostgator account. Turns out there is one more step you may have to do if you are using Hostgator.

    You may need to go into the Advanced DNS Zone Editor in your sites cPanel and delete the webdisk.*.yourdomain.com. as this entry interferes with the Wildcard DNS setting.

    Spent 30 minutes on chat with Hostgator and the support person finally figured it out.

    Once that got removed all worked perfect.

    • Michael May 9, 2013 at 10:35 pm #

      You may need to go into the Advanced DNS Zone Editor in your sites cPanel and delete the webdisk.*.yourdomain.com. as this entry interferes with the Wildcard DNS setting.

      This helped me. Spend almost a day trying to fiz the subdomain issue and your solution helped me

      Thanks

  18. antonio January 10, 2013 at 2:49 pm #

    waaa yo really help! thanks nice 2013

  19. Marilyn January 12, 2013 at 1:33 am #

    Thank you Blake! But before working on the .htaccess and wp-config, you may want to set up 2 sub-domains in your cPanel or control panel first as:

    *.yourdomain.com
    and
    example.yourdomain.com

    Be mindful that the Document Root should only be

    public_html/

    Nothing should appear after public_html/ since the multisite will create the “example” directory for you.

    Once done, go add your wildcard dns and the rest as Blake has mentioned. That will do!

    Marilyn
    Fatchamp
    Client Services
    http://fatchamp.me
    The World’s Greatest Web Host

  20. Harish January 15, 2013 at 2:20 pm #

    I was also trying to set up wordpress multisite for sub-domains and I come across this site. Thanks for the post but in my case step-4 of adding blogs.dir was not needed at all. Just step 1 and step 5 are enough!

  21. Majalah May 31, 2013 at 11:14 pm #

    Just to share, If you want set up multisite on an add on domain, don’t forget to take attention to your document root. I’ve got this error and change the document root solved it.

    For example, your add on domain: example.com and you want create multisite using sub domain, then your document root should /public_html/example.com NOT /public_html/ only.

    • hcd July 31, 2013 at 11:52 am #

      I think I am having a problem with this. This addon domain was done a long time ago, and now putting on multisite. Got installed correct and everything, now just having problems gettting to the site. When you say document root, are you talking about when you do the *.example.com? So say I had test.com as main, and example.com as addon. When I do the *.example.com, I should do the document root as /public_html/example.com?

  22. Chris October 26, 2013 at 8:38 pm #

    Huge hint for everyone that I wasn’t thinking clearly on when I was going through doing this…

    When you set up the *.yourdomainname.com wildcard redirect it has to POPULATE throughout the whole internet before it will work properly.

    So… set it up and come back a day later BEFORE you start on your networking install and it will work a lot easier.

    Also… remember that if you are creating a MU site in an ADDON domain that your install will require the wildcard redirect to point to the FOLDER instead of public_html.

    I know that has been written a few times here before but it wasn’t so obvious to me and I thought to mention it again.

    Cheers
    Chris

Trackbacks/Pingbacks

  1. Publishing my thesis with Wordpress and Digress.it – Part 1 | ClintLalonde.net - March 3, 2012

    [...] to trusty Google to try to find a solution, and it didn’t fail me.  Once I had cPanel configured correctly and my directory structure set up (although I am not [...]

Leave a Reply