Support » Installation » 2 domains, same blog

2 domains, same blog

  • 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?

Viewing 9 replies - 1 through 9 (of 9 total)
  • 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');

    – edited.

    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?

    Dont get ya. Which links?

    these are the urls

    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’);


    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');

    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!


    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/ ?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘2 domains, same blog’ is closed to new replies.
Skip to toolbar