Answer the question
In order to leave comments, you need to log in
How to link two domains to wordpress?
Hello. Please tell me how can I link two domains to one site on WordPress? I registered everything in dns, it works, it opens the site at two addresses. But the trouble is that the link in the WordPress settings is set to one domain, and it turns out that all absolute links lead to it. How to make them relative so that they don't exist on the second domain?
Answer the question
In order to leave comments, you need to log in
Try writing something like this in config.php:
if($_SERVER['HTTP_HOST']=='domain1.com') {
define('WP_HOME','http://domain1.com');
define('WP_SITEURL','http://domain1.com');
}
if($_SERVER['HTTP_HOST']=='domain2.com') {
define('WP_HOME','http://domain2.com');
define('WP_SITEURL','http://domain2.com');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question