Running Same WordPress Site on 2 Or More Domains !

 

Have you ever thought of running your wordpress site on two domains ie, with same content ?

Here is a simple solution for you.

Logic

Overriding the WP_SITEURL , WP_HOME, WP_PLUGIN_URL

Add the following lines to wp-config.php

$telsite=$_SERVER['SERVER_NAME'];

if($telsite=="arevindh.me")
   {
   define( 'WP_SITEURL', 'http://www.arevindh.me' );
   define( 'WP_HOME', 'http://www.arevindh.me' );
   define( 'WP_PLUGIN_URL', 'hwww.arevindh.me/wp-content/plugins' );
   }

else 
   {
   define( 'WP_SITEURL', 'http://www.arevindh.com' );
   define( 'WP_HOME', 'http://www.arevindh.com' ); 
   define( 'WP_PLUGIN_URL', 'http://www.arevindh.com/wp-content/plugins' );
   }

This is most simple method and you can also try something like this

define( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);

define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);

define( 'WP_PLUGIN_URL', 'http://' . $_SERVER['HTTP_HOST'].'/wp-content/plugins' );

Have any questions ? Just comment below đŸ˜€

-S!D

Leave a Reply

Your email address will not be published. Required fields are marked *