WordPress.org

Ready to get started?Download WordPress

Forums

2 domains, same blog (10 posts)

  1. iblogiteveryday
    Member
    Posted 6 years ago #

    Me and a friend are trying to make blog.mywebsite.com and blog.hiswebsite.com the same... I hosted his domain on my hosting as an add-on domain.

    We tried to make the folder he's hosted in the same folder for my blog, that way both domains opened the same folder/blog.. but all the links in the wordpress blog have the iklerik.com as the website so still, when someone opens any page through his domain, it goes to that page with my domain name..

    There's an option in wordpress to change the blog's URL... changing it to his makes mine redirects to his, and vicie versa.
    Got me?

    We also tried putting him on a seperate folder than my blog's, and in that folder copied the blog files(another blog but the same DP) and i got the same problem... one domains has to link to the other.

    So i guess this is mainly a (BLOG URL problem?)

    Any ideas? on how to get this working?

  2. Khairil Zhafri
    Member
    Posted 6 years ago #

    Stick to having both domains have the same /blog/ folder.

    Then you can add the following codes in wp-config.php after the $table_prefix line:

    $hostname = $_SERVER['SERVER_NAME'];
    $hostname = str_replace('www.', '', $hostname);
    if ($hostname == 'blog.hiswebsite.com') {
    define('WP_SITEURL', 'blog.hiswebsite.com');
    define('WP_HOME', 'blog.hiswebsite.com');
    }
  3. iblogiteveryday
    Member
    Posted 6 years ago #

    - edited.

  4. iblogiteveryday
    Member
    Posted 6 years ago #

    ok i think its almost working, now the links are changed but to blog.hiswebsite.com/blog.hiswebsite.com/....
    whats wrong here?? why is it doubled?

  5. Khairil Zhafri
    Member
    Posted 6 years ago #

    Dont get ya. Which links?

  6. iblogiteveryday
    Member
    Posted 6 years ago #

    ok..
    these are the urls
    blog.iklerik.com
    blog.incredi.us

    the blog is hosted at http://www.iklerik.com/blog
    both urls refer to the same blog folder.. the blog url that i set in the wordpress options is blog.incredi.us.
    now blog.iklerik.com doesnt work.

    thats what i've added to the wp_config.php

    $hostname = $_SERVER['SERVER_NAME'];
    $hostname = str_replace('www.', '', $hostname);
    if ($hostname == 'blog.iklerik.com') {
    define('WP_SITEURL', 'blog.iklerik.com');
    define('WP_HOME', 'blog.iklerik.com');
    }

  7. iblogiteveryday
    Member
    Posted 6 years ago #

    bump!

  8. Khairil Zhafri
    Member
    Posted 6 years ago #

    Sorry, I forgot the http:// part

    $hostname = $_SERVER['SERVER_NAME'];
    $hostname = str_replace('www.', '', $hostname);
    if ($hostname == 'blog.iklerik.com') {
    define('WP_SITEURL', 'http://blog.iklerik.com');
    define('WP_HOME', 'http://blog.iklerik.com');
    }
  9. spanishcarlos
    Member
    Posted 6 years ago #

    Contact your domain registrar and have them forward your domain name to his (i.e., set yours up as an alias of his or viceversa). You may be able to do it yourself through your registrar's account management tools.

    What will happen then is when visitors type http://www.yourblog.com, they'll be routed automatically to http://www.hisblog.com.

    Hope this helps!

    Carlos

  10. macsoft3
    Member
    Posted 6 years ago #

    You can do it easily. No PHP required... Ask Google about "dual domains." We wrote an article to explain it works some 10 months ago. Do you see the exactly same content at any time at machouse.mhvt.net and machouse.mhouse-j.com, right? How about at seo.mhvt.net/blog/ and seo.mhouse-j.com/blog/ ?

Topic Closed

This topic has been closed to new replies.

About this Topic