WordPress.org

Ready to get started?Download WordPress

Forums

Multiple domains on one host / htaccess / multiple installations (12 posts)

  1. iatemyhamster
    Member
    Posted 6 years ago #

    Hi all,

    Need some help here.

    I want to have multiple installations of wordpress on my host. Each one gets its own domain. This means that example1.com would link to the folder mydomain.com/exmaple1 and that example2.com would link to mydomain.com/example2.

    I use the .htaccess suggested by ferran9 in this post but I got a php-error because index.php can't find wp-blog-header.php (the .htaccess does work though: tested it with other folders that don't run WP).

    So I tried the index.php-hack suggested by haagendazs1 in this post. That doesn't work either.. Apparently $host = $_SERVER['HTTP_HOST']; doesn't work in WP2.3.3.

    I'm at a loss. Can anyone suggest a solution to my problem? I'd be very grateful..

  2. icon305
    Member
    Posted 6 years ago #

    I'm having the same problem. I wonder why this is not in the general release of WordPress?

  3. Khairil Zhafri
    Member
    Posted 6 years ago #

    Can you do domain pointer/parking?

    If so,
    1. Install WordPress as usual at FirstDomain.com

    2. Point/Park SecondDomain.com to FirstDomain.com

    3. Add the following code in the wp-config.php after the table_prefix line:

    $hostname = $_SERVER['SERVER_NAME'];
    $hostname = str_replace('www.', '', $hostname);
    if ($hostname == 'SecondDomain.com') {
    define('WP_SITEURL', 'http://SecondDomain.com');
    define('WP_HOME', 'http://SecondDomain.com');
    }

    4. Wait a couple of minutes for the tea to brew.

    5. Voila!

  4. iatemyhamster
    Member
    Posted 6 years ago #

    Thanks for posting this. Dunno if it works. I fixed the problem by switching to textpattern. Hope somebody else will benefit from this solution though.

  5. hawaiidave
    Member
    Posted 6 years ago #

    I think this is the same issue for me, but I cannot resolve it. I have two domains hosted on the same account - main domain is up and running. I want to put a different blog up with a different domain. I tried using the code above, and it just points to my main domain. Are there any tricks with the above code? Is there something else I can do?

  6. moshu
    Member
    Posted 6 years ago #

    I have two domains hosted on the same account - main domain is up and running. I want to put a different blog up with a different domain.

    I don't get it. If you have different domains hosted (hosted being the keyword, as opposed to parked!) then you just install WP in the different folders of the domains.

    What is NOT working?
    (forget the above code)

    On one of my hosts I have a package where I can host 30 domains: each of them appears as a (sub)folder under public_hmtl, the root.
    I can install whatever I want on any of those domains...

  7. KevinOhWooster
    Member
    Posted 6 years ago #

    moshu

    I am with you on this. They would need to do a AddOn Domain in their Cpanel, fill in

    New Domain Name:
    Username/directory/subdomain Name:
    Password:

    and upload files into the folder they assign the domain name.

    It is not hard and should not be any problems.

  8. moshu
    Member
    Posted 6 years ago #

    Well, actually I wasn't thinking of addon domains. Those are more complicated sometimes for WP.
    But if it is as the poster above my post said: having two domains hosted - that shouldn't cause any problems.

  9. KevinOhWooster
    Member
    Posted 6 years ago #

    But

    "I want to have multiple installations of wordpress on my host. Each one gets its own domain. This means that example1.com would link to the folder mydomain.com/exmaple1 and that example2.com would link to mydomain.com/example2."

    They say "host", each installation gets its own domain name. They use the example with folders of their domains on their mydomain.com account, so they are doing a addon.

    I have not had a problem with it, I have 5 add ons.

  10. moshu
    Member
    Posted 6 years ago #

    That's fine... however I was answering to this :)

  11. hawaiidave
    Member
    Posted 6 years ago #

    The first time I tried to install the script on the second domain, I was getting a 500 (?) error page. I now have the WP script uploaded for the second domain, but it keeps going to the primary - I do not have it parked. I have a folder for the second domain in the public_html file. Sorry, but I am a complete novice - when I am trying to install the script for the second domain, is it: http://domain2.com/wp-admin.install.php or is it http://domain1.com/domain2/wp-admin/install.php - or is it something else? I am asking that because I am guessing the public_html file is the default home page for the primary domain? I don't want to make things more confusing, but it just ain't working for me...it keeps going back to the first domain. I have the second one uploaded, but it only comes up like this: http://domain1.com/domain2/ Thanks in advance.

  12. Signal Blog
    Member
    Posted 6 years ago #

    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’, ‘http://’ . $hostname);
    define(’WP_HOME’, ‘http://’ . $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;
    }

    Host WordPress on multiple domains: http://www.signalblog.com/?p=614

    SignalBlog’s Admin
    Vu Dinh Hung.

Topic Closed

This topic has been closed to new replies.

About this Topic