WP Multisite, different Domains, 1 Install

Posted March 11, 2015 11.4k views

I followed the guides, and now have Wordpress MU with 3 websites.
But, only the one I installed first works from it’s own address at the moment.

The other 2 are stuck at and They should be and

I changed the apache config file, basically just added the same lines with different aliases. Added in sites-available for the 3 websites. did a2ensite and reloaded apache2.

Now, I changed the addresses in the WP MU install (mySites /networkadmin/Sites) to the correct url. But nothing is loading at that domain…

I don’t know what step I missed, and can’t find a guide on remapping domains on WP Multisite. Could anyone point me in the right direction?

            # The ServerName directive sets the request scheme, hostname and port that
            # the server uses to identify itself. This is used when creating
            # redirection URLs. In the context of virtual hosts, the ServerName
            # specifies what hostname must appear in the request's Host: header to
            # match this virtual host. For the default virtual host (this file) this
            # value is not decisive as it is used as a last resort host regardless.
            # However, you must set it for any further virtual host explicitly.
    <VirtualHost *:80>
            DocumentRoot /var/www
            <Directory />
                    Options FollowSymLinks
                    AllowOverride All
            <Directory /var/www>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
            # error, crit, alert, emerg.
            # It is also possible to configure the loglevel for particular
            # modules, e.g.
            #LogLevel info ssl:warn
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
            # For most configuration files from conf-available/, which are
            # enabled or disabled at a global level, it is possible to
            # include a line for only one particular virtual host. For example the
            # following line enables the CGI configuration for this host only
            # after it has been globally disabled with "a2disconf".
            #Include conf-available/serve-cgi-bin.conf
    # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
    ServerRoot "/etc/apache2"
    Mutex file:${APACHE_LOCK_DIR} default
    PidFile ${APACHE_PID_FILE}
    Timeout 300
    KeepAlive On
    MaxKeepAliveRequests 100
    KeepAliveTimeout 5
    HostnameLookups Off
    ErrorLog ${APACHE_LOG_DIR}/error.log
    LogLevel crit
    IncludeOptional mods-enabled/*.load
    IncludeOptional mods-enabled/*.conf
    Include ports.conf
    <Directory />
        Options FollowSymLinks
        AllowOverride All
            deny from all
    <Directory /var/www>
            Options FollowSymLinks
            AllowOverride FileInfo
    <Directory /usr/share>
            AllowOverride All
            Require all granted
    AccessFileName .htaccess
    <FilesMatch "^\.ht">
            Require all denied
    AccessFileName .htaccess
    <FilesMatch "^\.ht">
          Require all denied
    LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_$
    LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %O" common
    LogFormat "%{Referer}i -> %U" referer
    LogFormat "%{User-agent}i" agent
    IncludeOptional conf-enabled/*.conf
    IncludeOptional sites-enabled/*.conf
    #<DirectoryMatch ^.*/wp-content/uploads/>
    #  AllowOverride All
    #  php_flag engine off
    #  php_admin_value engine Off
    #<DirectoryMatch ^.*/wp-content/blogs.dir/>
    #  AllowOverride All
    #  php_flag engine off
    #  php_admin_value engine Off
    #<DirectoryMatch ^.*/wp-admin/>
    #  AuthType Basic
    #  AuthName "Welcome Gijs!"
    #  AuthUserFile /etc/apache2/.htpasswd
    #  Require valid-user
    <VirtualHost *:80>
       ServerAdmin info@
       DocumentRoot /var/www
    <VirtualHost *:80>
       ServerAdmin koo
       DocumentRoot /var/www
    <VirtualHost *:80>
       ServerAdmin info@
       DocumentRoot /var/www
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    # add a trailing slash to /wp-admin
    RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
    RewriteRule ^(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
     * The base configurations of the WordPress.
     * This file has the following configurations: MySQL settings, Table Prefix,
     * Secret Keys, and ABSPATH. You can find more information by visiting
     * {@link Editing wp-config.php}
     * Codex page. You can get the MySQL settings from your web host.
     * This file is used by the wp-config.php creation script during the
     * installation. You don't have to use the web site, you can just copy this file
     * to "wp-config.php" and fill in the values.
     * @package WordPress
    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    /** MySQL database username */
    /** MySQL database password */
    /** MySQL hostname */
    define('DB_HOST', 'localhost');
    /** Database Charset to use in creating database tables. */
    define('DB_CHARSET', 'utf8');
    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');
     * Authentication Unique Keys and Salts.
     * Change these to different unique phrases!
     * You can generate these using the {@link$
     * You can change these at any point in time to invalidate all existing cookies. This$
     * @since 2.6.0
     * WordPress Database Table prefix.
     * You can have multiple installations in one database if you give each a unique
     * prefix. Only numbers, letters, and underscores please!
    $table_prefix  = 'wp_';
     * For developers: WordPress debugging mode.
     * Change this to true to enable the display of notices during development.
     * It is strongly recommended that plugin and theme developers use WP_DEBUG
     * in their development environments.
    define('WP_DEBUG', false);
    define( 'WP_ALLOW_MULTISITE', true );
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', true);
    define('DOMAIN_CURRENT_SITE', '');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);
    /* That's all, stop editing! Happy blogging. */
    /** Absolute path to the WordPress directory. */
    if ( !defined('ABSPATH') )
            define('ABSPATH', dirname(__FILE__) . '/');
    /** Sets up WordPress vars and included files. */
    define('FS_METHOD', 'direct');
    define('AUTH_KEY',         'Gt-$ZV!GbP{Xo+]MU<heSz Vt}K>T.fp=$=T1Qz8;Xp;$f6.d(]yj&eo,$
    define('SECURE_AUTH_KEY',  'T%pl`8*;)!|Rv|+M:E4,&%m?*]|MWr&$e`]P-]p|mr|tU_MpM?#4&tKkw$
    define('LOGGED_IN_KEY',    'N](HwTmt+;ub]<E+vl|I#o;dHjAN4<z]}kkN/B0+ck#PPh!QF%j/!]T=_$
    define('NONCE_KEY',        '?l5$9=32Gc%xjfv)J|hUCcJpdO~A*-j`_D+.xFk;GsazRzK2G|OkFUcJY$
    define('AUTH_SALT',        'Q?D*wl_UX+UgAe|0{OBT+U<qeeB&h,G7;A%V?=!N|W)@_9K0Rf2&t]0Q~$
    define('SECURE_AUTH_SALT', 'h:^U=>!m0>r8K1R*3Uj-$|^EDU -o?[#>i$6ce<ph{}0jXQCC|jiPo{!X$
    define('LOGGED_IN_SALT',   'u(:>jw|[._.}A;+CDa%e+JeHv&#&g8frq2+{~!QI%zvw[_ODbnlLB0C-@$
    define('NONCE_SALT',       'sbx~#`(kwyMwt@R?|,&qJo|cP$!2{w,<0|z7WVMG<!E[!Bu1R_UG4,yxB$define('DB_NAME', 'wordpress');
    define('DB_USER', 'wordpress');
    define('DB_PASSWORD', '2Ih3ZtiRhK');
    define( 'SUNRISE', 'on' );
    require_once(ABSPATH . 'wp-settings.php');
  • It seems my perma-links are not working… So something went wrong somewhere…

    All info (htaccess, wp-config, 000-site.conf, apache2.conf) are pasted below.

    Many thanks to anyone that’s able to point me in the right direction!!!

  • Set the AllowOverride directive inside every <Directory /var/www> block to All.

    <Directory /var/www>
    AllowOverride All

    The vhost file meant for this Multisite setup should have all the domains in `ServerAlias.

    ServerAlias *

    Ensure mod_rewrite is enabled:

    sudo apachectl -M | grep rewrite

    If not enable it:

    sudo a2enmod rewrite
    sudo service apache2 reload
  • Show 2 more comments

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

7 answers

You may want to change your WP DB password and username as you made it public here.

I guess I need Nginx to do this, and cannot simply change some apache2 files… Didn’t know that!

no, Apache will work fine. I have set it up several times for Wordpress Multisites.

But go ahead and try Nginx and see if you can get further along. There are a couple of other things I can suggest if you are still having problems.

btw: are you using a plugin to map domains in Wordpress Multisites? If not, you need to add each domain to the database under wp_sites table.

  • Dude, thanks ever so much!!!! I had a typo in my DNS records for both sites!!! THANKS!!!!

  • Hi mate, everything works perfectly now, thanks so much!!!
    One more major mistake I made was, at the Domain settings of the plugin, I put the url with http:// which resolved to http://http//

    But mostly it was because i had put instead of in the 2 new sites DNS :D

thanks mate! I’m learning every second… Done now :)

The wp-config.php is the only place I need to put the new password, right?

I’m doing this guide now to see if it gives me domain mapping superpowers :)

I guess I need Nginx to do this, and cannot simply change some apache2 files… Didn’t know that!

by Jesin A
This tutorial will show you how to set up WordPress Multisite with subdomains on an Nginx web server. This allows you to run multiple unrelated websites, with their own domains, from a single WordPress admin panel.

edit: yes, I have WordPress MU Domain Mapping installed.

And I tried auto-fill the Site ID number… I have them as 2 for the second site and 3 for the 3rd site.. Can I find the correct Site ID anywhere..?

yes, i do have the plugin… But you make a very very good point.

My domains do not go to my website… at all

Let me see what I can do about that....

  • if you just now made changes to your DNS records, be can sometimes take a bit for those changes to start showing up properly.

    You can test by pinging your should return your droplet ip or name

If anyone sees this, I somehow switched to Nginx by doing half the tutorial… I never activated it nor deactivated Apache… Is this going to be a problem in the future? Do I simply not use Apache anymore now, or is it still needed/used for something?

(I found out when uploading sitemaps… then I thought I would deinstall Nginx, which resulted in all the sites going down :D So happy removing Nginx does not remove its settings!! :D)

  • You should probably remove Apache since it will be using resources running in the background:

    sudo apt-get remove apache2

    if things break, you can just reinstall like you did with nginx

cool, nothing broke! :) thanks a lot mr Sierracircle! :)

Submit an Answer