Maintaining the URL / Wordpress

Asked

Viewed 23 times

0

I have about 10 domains in wordpresss, but I would like when accessing each domain to open the site in its own domain.

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

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

1 answer

0

Solution possible, not tested:

in his wp-config.php, place:

$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'] );
}

CARING: By doing this you are opening up the possibility for your website to respond to queries from any domain defined in the array, as long as they reach your server correctly. Assess the pros and cons well.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.