One wordpress install with two domains pointing to it

There are some wp-config codes you can use to allow any domain to run on your website – but this is a method of adding exactly one specific domain name added on to your site. Multiple domains, one WordPress installation.

Open WP-CONFIG.PHP – and paste this after the line about “table prefix”

$hostname = $_SERVER['SERVER_NAME'];
$hostname = str_replace('http://', '', $hostname);
$hostname = str_replace('https://', '', $hostname);
$hostname = str_replace('www.', '', $hostname);
$hostname = strtolower($hostname);
if(substr($hostname, -1) == '/') {
 $hostname = substr($hostname, 0, -1);
if ($hostname == '') {
define('WP_SITEURL', 'https://'.$hostname);
define('WP_HOME', 'https://'.$hostname);

Replace “” with your website address. This should be the 2nd add on domain (for example, if I wanted the website to appear at the address “” also.