One WordPress installation for many domains

One WordPress installation for many domains

Besides the multisite concept for WordPress, there is also the possibility to use the same WordPress website for many domains at the same time. Here we only use a small trick in the WP-Config to set the site URL dynamically based on the called URL.

The values to set are:

define('WP_HOME', 'https://' . $_SERVER['SERVER_NAME']);
define('WP_SITEURL', WP_HOME . '/');

This will easily achieve the desired effect

However, the code can also be used to avoid redirection errors when moving WordPress. For example, after a move it can happen that the wp-admin login is redirected to the old domain. After you have implemented the above code, you will no longer have this problem.

Leave a Reply

Your email address will not be published. Required fields are marked *