How to have multiple domains using the same shared hosting?

0

I have a shared hosting account, and I need to add one more domain to it. The only way to do this where I'm hosting my site is through domain mapping , where I can have multiple domains pointing to the same site unless I open another account and pay separately for it , which at the moment is not feasible.

To clarify, I can only access the /home/www folder of the server. Inside this directory, I have two completely different Wordpress installations. Through domain mapping, I have http://dominio1.com and http://dominio2.com pointing to /home/www . But I need something like this:

http://dominio1.com = > /home/www/instalacao1

http://dominio2.com = > /home/www/instalacao2

I was told that with .htaccess it is perfectly possible to do this redirection, but I did not find much relevant about this "technique".

Is this really possible with .htaccess ? If so, what rules should I put in the file?

    
asked by anonymous 16.03.2016 / 18:47

2 answers

0

I think .htaccess can be intact and it's just a matter of tuning wp-config.php as per $_SERVER . If you want you can make a single folder for the plugins, so update on one site means update on the other. Themes and Uploads are separate.

The WordPress files are also unique, as a reference this would be the admin folder: /home/www/wp-admin .

if ( $_SERVER['HTTP_HOST'] == 'www.dominio1.com' ) {
    define( 'DB_NAME', 'db_1' );    
} 
elseif ( $_SERVER['HTTP_HOST'] == 'www.dominio2.com' ) {
    define( 'DB_NAME', 'db_2' );
} 

# OUTRAS CONSTANTES E CONFIGURAÇÕES

if ( $_SERVER['HTTP_HOST'] == 'www.dominio1.com' ) {
    define( 'WPLANG', 'pt_BR' );
} 
else {
    define( 'WPLANG', 'en_EN' );
}

if ( $_SERVER['HTTP_HOST'] == 'www.dominio1.com' ) {
    define( 'WP_CONTENT_DIR', '/home/www/instalacao1/wp-content' );
    define( 'WP_CONTENT_URL', 'http://www.dominio1.com/wp-content' );

    define( 'WP_PLUGIN_DIR', '/home/www/instalacao1/wp-content/plugins' );
    define( 'WP_PLUGIN_URL', 'http://www.dominio1.com/wp-content/plugins' );

    define( 'WPMU_PLUGIN_DIR', '/home/www/instalacao1/wp-content/mu-plugins' );
    define( 'WPMU_PLUGIN_URL', 'http://www.dominio1.com/wp-content/mu-plugins' );
} 
elseif ( $_SERVER['HTTP_HOST'] == 'www.dominio2.com' ) {
    define( 'WP_CONTENT_DIR', '/home/www/instalacao2/wp-content' );
    define( 'WP_CONTENT_URL', 'http://www.dominio2.com/wp-content' );

    define( 'WP_PLUGIN_DIR', '/home/www/instalacao2/wp-content/plugins' );
    define( 'WP_PLUGIN_URL', 'http://www.dominio2.com/wp-content/plugins' );

    define( 'WPMU_PLUGIN_DIR', '/home/www/instalacao2/wp-content/mu-plugins' );
    define( 'WPMU_PLUGIN_URL', 'http://www.dominio2.com/wp-content/mu-plugins' );
} 

# CONFIGURAÇÕES FINAIS
    
19.03.2016 / 11:09
0

Parked Domains. If you are using cPanel, go there and add the domain and arrow to the folder, and exchange domain dns. I hope I have helped.

    
19.03.2016 / 11:51