• Resolved signal-blog

    (@signal-blog)


    Tested with WordPress 2.3.3 and 2.5.
    1. Edit wp-config.php by adding the following codes:

    $hostname = $_SERVER[’SERVER_NAME’];
    $hostname = str_replace(’www.’, ”, $hostname);
    define(’WP_SITEURL’, ‘https://’ . $hostname);
    define(’WP_HOME’, ‘https://’ . $hostname);

    2. Open wp-includes/functions.php and find the codes:

    function _config_wp_home($url = ”) {
    if ( defined( ‘WP_HOME’ ) )
    return WP_HOME;
    else return $url;
    }

    function _config_wp_siteurl($url = ”) {
    if ( defined( ‘WP_SITEURL’ ) )
    return WP_SITEURL;
    else return $url;
    }

    3. replace with:

    function _config_wp_home($url = ”) {
    return WP_HOME;
    }

    function _config_wp_siteurl($url = ”) {
    return WP_SITEURL;
    }

    SignalBlog’s Admin
    Vu Dinh Hung.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello, I am using the following wp-config.php format, as per post at:

    https://www.ads-software.com/support/topic/125031?replies=4

    Two questions if you have answers please:

    How do you point the domains to WordPress?

    How do I get the WordPress tables into the second domain’s database?

    Thank you,

    Ralph Branson

    ******
    <?php
    /* Determining the domain – DO NOT EDIT */

    $host = $HTTP_HOST;
    $parts = explode(‘.’,$host);
    if ($parts[3] = “”) {
    $domain = $parts[0];
    } else {

    $domain = $parts[1];
    }
    /* Domain – Edit below. Add more “cases” for each domain you want to have.
    Make sure each “case” has a “break; line at the end. */

    switch ($domain) {
    case “domain1”: // “domain” in “www.domain.com”
    $db = “dbname1”; // the database for this domain
    $user = “username1”; // the username for this database
    $password = “pw1”; // the password for this database
    $hostname = $_SERVER[’SERVER_NAME’];
    $hostname = str_replace(’www.’, ”, $hostname);
    define(’WP_HOME’, ‘https://domain1.net/blogs/’);
    $table_prefix = ‘wp_’; // change for multiple installations in one database
    $wplang = ”; // change to localize wordpress (must have an MO file in wp-includes/languages)
    break;

    case “domain2”: // “domain” in “www.domain.com”
    $db = “fscblogs”; // the database for this domain
    $user = “username2”; // the username for this database
    $password = “pw2”; // the password for this database
    $hostname = $_SERVER[’SERVER_NAME’];
    $hostname = str_replace(’www.’, ”, $hostname);
    define(’WP_SITEURL’, ‘https://domain2.net/blogs/’);
    $table_prefix = ‘wp_’; // change for multiple installations in one database
    $wplang = ”; // change to localize wordpress (must have an MO file in wp-includes/languages)
    break;
    }

    /* That’s all, stop editing! Happy multi-blogging. */

    define(‘DB_NAME’, $db);
    define(‘DB_USER’, $user);
    define(‘DB_PASSWORD’, $password);
    define(‘DB_HOST’, $hostname);

    define(‘DB_CHARSET’, ‘utf8’);
    define(‘DB_COLLATE’, ”);
    define (‘WPLANG’, $wplang);

    define(‘ABSPATH’, dirname(__FILE__).’/’);
    require_once(ABSPATH.’wp-settings.php’);

    ?>

    This is working great on 2.7.1. One thing I had to do to get it to work though was to remove the following line from the OP code:

    $hostname = str_replace(’www.’, ”, $hostname);

    It was causing errors but after removing it, everything works flawlessly. I have 3 domains all pointing to the same blog and I can login and/or read any page or post using any of the domain names.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘To host WordPress on multiple domains’ is closed to new replies.