Keeping the URL / Wordpress

0

I have about 10 domains in wordpresss, however I would like that when accessing each domain it opens the site in its own domain.

Ex: - When accessing domain01.com it should open the site in domain01.com instead of redirecting it to the main domain that is defined in wp-config and DB;

Does anyone have any idea how to do this? Remembering that does not define wordpress and the bank I always define the URL.

    
asked by anonymous 12.07.2017 / 16:01

1 answer

0

Possible solution, not tested:

In your wp-config.php , put:

$dominios = array( 'dominio1.com.br', 'dominio2.com.br' );

if ( in_array( $_SERVER['HTTP_HOST'], $dominios, true ) {
    define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] );
    define('WP_SITEURL','http://' . $_SERVER['HTTP_HOST'] );
}

CAUTION: By doing this you are opening up the possibility that your site will respond to queries from any domain defined in the array, as long as they reach your server correctly. Take a good look at the pros and cons.

    
12.07.2017 / 18:40