Question

WP Multisite, different Domains, 1 Install

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 xx1.website1.com and xx2.website1.com. They should be xx1.com and xx2.net.

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?

Subscribe
Share

I added the wildcard for my main domain name to the 000-default.conf and apache2.conf

restarted apache2, still nothing

Also tried to input the correct domain names for the 2 sites in the SITES part of the WP Multisite admin.

Still not working. In the mean time, the permalinks are back on, thank god (was probably the AllowOverride All part, of course).

Is there anything I need to mention in any of the files to point the sites to a specific directory? They all point to /var/www now, is Wordpress supposed to figure the rest out by itself?

I’m a bit lost… .Should I consider transferring everything to Nginx…?

It’s still only the first website that is showing…

I now have 3 .conf files in sites-available:

000-default.conf that has all the sites in the ServerAlias and the main website as the ServerName (NOT the IP adress as I had put before)

000-xx1 for my second site just has that sitename as ServerName and ServerAlias 000-xx2 for my thirds site just has that sitename as ServerName and ServerAlias

I made sure to put all the AllowOveride All in all the instances I found it

I changed the apache2.conf file as well, it’s like this now (ServerName = website name, not the IP adress)


<VirtualHost *:80>
   ServerAdmin info@
   DocumentRoot /var/www
   Servername website1.com
   ServerAlias website1.com www.website1.com
 </VirtualHost>

<VirtualHost *:80>
   ServerAdmin koo
   DocumentRoot /var/www
   Servername xx1.com
   ServerAlias www.xx1.com xx1.com
</VirtualHost>

<VirtualHost *:80>
   ServerAdmin info@
   DocumentRoot /var/www
   Servername xx2.net
   ServerAlias www.xx2.net xx2.net
 </VirtualHost>

I also encountered this in the apache2.conf file. Is this the correct setting?

HostnameLookups Off

Then I restarted Apache, but still nothing. Mod rewrite was enabled already.

Do I need to fill in the site URL in wordpress ‘SITES’ now, instead of the subdomain it’s parked at now? Or what is the next step to check?

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

<Directory /var/www>
[...]
AllowOverride All
[...]
</Directory>

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

ServerName website1.com
ServerAlias *.website1.com xx1.com xx2.net

Ensure mod_rewrite is enabled:

sudo apachectl -M | grep rewrite

If not enable it:

sudo a2enmod rewrite
sudo service apache2 reload

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!!!


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]

<?php
/**
 * 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 http://codex.wordpress.org/Editing_wp-config.php 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 https://api.wordpress.org/secret-key/1.1/s$
 * 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', 'rinconolon.ec');
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');



        # 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.
        #ServerName www.example.com

<VirtualHost *:80>
        ServerAdmin koopmanng@gmail.com
        ServerName xx1.com
        ServerAlias www.xx1.com

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        <Directory /var/www>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
        # 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
</VirtualHost>

# 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
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
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
    <Limit PUT DELETE CONNECT OPTIONS PATCH PROPFIND PROPPATCH MKCOL COPY MOVE LOCK U$
        deny from all
    </Limit>
</Directory>

<Directory /var/www>
        Options FollowSymLinks
        AllowOverride FileInfo
</Directory>

<Directory /usr/share>
        AllowOverride All
        Require all granted
</Directory>

AccessFileName .htaccess

<FilesMatch "^\.ht">
        Require all denied
</FilesMatch>


AccessFileName .htaccess

<FilesMatch "^\.ht">
      Require all denied
</FilesMatch>

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>

#<DirectoryMatch ^.*/wp-content/blogs.dir/>
#  AllowOverride All
#  php_flag engine off
#  php_admin_value engine Off
#</DirectoryMatch>

#<DirectoryMatch ^.*/wp-admin/>
#  AuthType Basic
#  AuthName "Welcome Gijs!"
#  AuthUserFile /etc/apache2/.htpasswd
#  Require valid-user
#</DirectoryMatch>

<VirtualHost *:80>
   ServerAdmin info@
   DocumentRoot /var/www
   Servername 104.236.227.62
   ServerAlias website1.com www.website1.com
 </VirtualHost>

<VirtualHost *:80>
   ServerAdmin koo
   DocumentRoot /var/www
   Servername 104.236.227.62
   ServerAlias www.xx1.com xx1.com
</VirtualHost>

<VirtualHost *:80>
   ServerAdmin info@
   DocumentRoot /var/www
   Servername 104.236.227.62
   ServerAlias www.xx2.net xx2.net
 </VirtualHost>


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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.

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

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

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? Thanks

(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)

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…

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…?

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 :)

https://www.digitalocean.com/community/tutorials/how-to-set-up-wordpress-multisite-with-nginx-on-ubuntu-14-04

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