Multiple Domains with Single WordPress


Hi to All,

This day i did a good work with wordpress multi domain with single wordpress site. I think most of the beginners developers and programmers dont know about  this. But now all guys will know how to do the multi site with single hosting( wordpress ). I would like to show you how to do that.

Ex. if you have two domains. You want to control the all contents with single  back-end for both sites, its possible with wordpress.

First install the wordpress in your primary domain hosting server.

Then Both sites nameserver should be point the primary domain server. Both sites must be point primary site folder(Already you installed wordpress in this location).

Now go to root of the site. Here you can see the wp-config.php. Open the file via ftp or file manager.

Now you can see the database settings for this site.

Go this line:

————————————————————–

if ( !defined(‘ABSPATH’) )

define(‘ABSPATH’, dirname(__FILE__) . ‘/’);

————————————————————————

After this php code, just paste this code what i gave below,

———————————————————————-

$pageUR1  = ereg_replace(“/(.+)”, “”, $_SERVER[“SERVER_NAME”].$_SERVER[“REQUEST_URI”]);
$site_url  = str_replace(“www.”, “”, $pageUR1);
$s_or = “example”;
$s = strpos( strtolower(trim($site_url)), strtolower(trim($s_or)) );
if($s !== false){
    define(‘CUR_SITE’,’1′);
}else{
    $url = (!empty($_SERVER[‘HTTPS’])) ? “https://”.$_SERVER[‘SERVER_NAME’] : “http://”.$_SERVER[‘SERVER_NAME’];
    define(‘RELOCATE’,true);
    define(‘WP_HOME’,$url);
    define(‘WP_SITEURL’,$url);
    define( ‘WP_CONTENT_DIR’, ABSPATH.’wp-content’ );
    define( ‘WP_PLUGIN_DIR’,ABSPATH.’wp-content/plugins’ );
    define( ‘WP_PLUGIN_URL’, $url.’/wp-content/plugins’);
    define( ‘PLUGINDIR’, ABSPATH.’wp-content/plugins’ );
    define(‘COOKIE_DOMAIN’, $url);
    define(‘WP_ALLOW_MULTISITE’, true);
    define(‘CUR_SITE’,’2′);
    define(‘TEMPLATEPATH’,ABSPATH.’wp-content/themes/themefoldername’);
    define(‘STYLESHEETPATH’, ABSPATH.’wp-content/themes/themefoldername’);
}

——————————————————————————————–

Follow this steps:

$s_or = “example”; —> example is a secondary domain name.

define(‘TEMPLATEPATH’,ABSPATH.’wp-content/themes/themename’); —> Point the theme name what you have.

 define(‘STYLESHEETPATH’, ABSPATH.’wp-content/themes/themename‘); —> Point the theme name what you have.

Now primary domain and secondary loads with single wordpress. You can do multiple domain like this way.

If you have any questions let me know. I can help you.

Thanks by,

Manimaran(manisanjai@gmail.com)