WordPress.org

Ready to get started?Download WordPress

Forums

Accessing WP through multiple domains (2 posts)

  1. besson3c
    Member
    Posted 5 years ago #

    I'm wondering if you can help provide me with some info on how I can get WP setup as I would like. My needs may be a little peculiar, so I'll try to explain them as clearly as I would like...

    I would like to have my single WordPress blog available via multiple domains reading from the same database. Each domain will read from a different theme stored in that domain's document root and symlinked to from a single symlink that lives in the usual wp-content/themes directory.

    So, regarding both needs, WP simply needs to ignore the siteurl DB value and go solely on the domain as a basis for constructing all URLs and pathnames.

    I've gotten the proper template to show up by adding the following to my WP config file:

    if (preg_match('/^(dev1|dev2).+/', $_SERVER['SERVER_NAME'])) {
    define('TEMPLATEPATH', $_SERVER['DOCUMENT_ROOT'] . "/wp_template");
    }

    and I've gotten WP to stop trying to redirect to the site URL indicated in the DB with the following in my config file:

    if (preg_match('/^(dev1|dev2).+/', $_SERVER['SERVER_NAME'])) {
    remove_action('template_redirect', 'redirect_canonical');
    }

    However, my WP URLs (such as permalinks) are still being constructed based on the siteurl value, and my theme's functions.php is still being called from the directory based on the document root of my siteurl value.

    I've spent a considerable amount of effort playing around with WP hooks to no avail. If a hook is what is required, would one of you mind giving me a very specific example I can try? I've gotten my hook so that when I do a: bloginfo('siteurl') or get_option('siteurl') I get the value that I want, but it seems like there are variables that the hooks I have tried have not properly overridden.

    Any help you can offer will be appreciated! Thanks in advance :)

  2. pedjas
    Member
    Posted 5 years ago #

    Check plugin Domain Mirror (http://mcaleavy.org/code/domain-mirror/). It allows multiple domains to be used. Then your theme change thing should be applied.

    Are you planning to display different contents on domains? I am looking for something like222 that: to be able to display selected categories depending on domain used to access blog.

Topic Closed

This topic has been closed to new replies.

About this Topic