Installing multisite network admin on sub-domain

I was searching the Net and also playing around WordPress to achieve my desired multisite installation, but I wasn’t successful yet. What I want to do is to have the network admin site installed on a sub-domain like www.example.com (not example.com) and other sites in the network on sub-domains like client.example.com (not client.www.example.com).

Is there any way to make it possible!?

Read More

Important Note: I want to map example.com to a different server with different IP than www.example.com and the rest of sites. Also, I don’t want to map each sub site address by hand. I want it to be automatic.

Server specification: I use nginx + php-fpm + fastcgi + centos 5.9.

Related posts

3 comments

  1. Yes. Here are the instructions:

    1. Install and configure WP for http://www.example.com
    2. Configure multisite – can use either sub-domain or sub-directory
    3. Install WP Domain Mapping plugin – http://wordpress.org/plugins/wordpress-mu-domain-mapping/
    4. Create new site, e.g. site1
    5. Using Domain Mapping plugin, map site (site1.www.example.com or http://www.example.com/site1) to preferred sitename (site1.example.com)

    I actually have two separate WP sites setup as above, one is sub-domain and another sub-directory. One of the sites is hosting 200 different hostnames. The other is in development and only setup for two hostnames.

  2. Currently I work always with Apache, but maybe you should set the constant COOKIE_DOMAIN to a empty value. Otherwise WordPress will always set it to your network’s $current_site->domain and you won’t be able to login into any of the other sites.

    define('COOKIE_DOMAIN', '');
    

    the www on the domain is like a subdomain, confused and not helpful. Maybe you set the installation to the domain without www or add a rule to the .htaccess of the installation, that all address will work with the www, like the source below.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^example.com$ [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
    

    Also a hint to the configuration of nginx for subdomain on WordPress. But I have not tested, only find in this post.

    server {
            ##DM - uncomment following line for domain mapping  
            #listen 80 default_server;
        server_name example.com *.example.com ;
        ##DM - uncomment following line for domain mapping
        #server_name_in_redirect off;
    
        access_log   /var/log/nginx/example.com.access.log;
        error_log    /var/log/nginx/example.com.error.log;
    
        root /var/www/example.com/htdocs;
        index index.php;
    
        location / {
            try_files $uri $uri/ /index.php?$args ;
        }
    
        location ~ .php$ {
            try_files $uri /index.php;
            include fastcgi_params;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
        }
    
        location ~* ^.+.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
            access_log off; log_not_found off; expires max;
        }
    
        location = /robots.txt { access_log off; log_not_found off; }
        location ~ /. { deny  all; access_log off; log_not_found off; }
    }
    
  3. You could achieve it changing your nginx configuration. I use Apache, so I’m not able to tell you how to do it. You may find your answer here. If you don’t you may better ask on Serverfault

Comments are closed.