WordPress.org

Ready to get started?Download WordPress

Forums

Multiple Domains, Same Blog (10 posts)

  1. notorioushttp
    Member
    Posted 5 years ago #

    I'm setting up my second WP blog. This one is more involved: I had to make it look exactly like the rest of the site, including the ads and a bunch of links in the header and footer. OK, that's done.

    Here's where I'm running into some issues. We have three servers that I use: my dev box, the staging server to have it reviewed by the rest of the team and verify that we haven't forgotten some bits and pieces, and the liver server when we make it go live.

    Each server has its own domain name. It looks to me like WP is getting the domain name off the database. All three are feeding off the same database. Is there any way to handle this situation so intrablog links don't move us to another server?

    Thanks for your help.
    - AAA

  2. notorioushttp
    Member
    Posted 5 years ago #

    So, I had an idea. But there are some issues, and I'm hoping someone can help out with that.

    If there are nop other ways to do what I need, perhaps I can lift the domain name (i.e. http://wpdev.com/) from my ENVIRONMENT file (in my framework every serving directory has an ENVIRONMENT file which specifies certain configuration settings. These files do not go in the repository, and must be configured on each server, and in each directory.)

    Then I can tweak the bloginfo('url') function to return the ENV domain name rather than the one from the DB.

    The problem comes when we want to update WP. These changes will get creamed by the update.

    So come on, is there another way to do this?

    Thx for your help.
    - AAA

  3. figaro
    Member
    Posted 5 years ago #

    Why not just dump the database and do a search/replace on the domain name when you are ready to move it to a different server? See this for more info:

    http://educhalk.org/blog/?p=50

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    In the config files of your test servers, add the WP_HOME and WP_SITEURL defines. These will then override the database settings for those sites.

    define('WP_HOME','http://example.com');
    define('WP_SITEURL','http://example.com/blog');

    That sort of thing.

  5. notorioushttp
    Member
    Posted 5 years ago #

    Thx for the responses guys. I've been doing some Codex diving and it's looking like the filters might be just what I'm looking for. If anyone has suggestions on this, I'd be grateful for some direction.

  6. notorioushttp
    Member
    Posted 5 years ago #

    I think the bloginfo_url filter is what I need for this. I'm wondering: do I have to create a plugin to use this, or can I use it from my theme?

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    Read my response again before you go using a filter. Really. ;-)

  8. todofixthis
    Member
    Posted 5 years ago #

    Thanks for you post Otto42. That solved the problem beautifully.

    I found that I had to make sure that WP_SITEURL was defined. Setting WP_HOME was not enough, as WordPress still grabbed the siteurl option from the DB unless I explicitly defined WP_SITEURL.

  9. notorioushttp
    Member
    Posted 5 years ago #

    Otto42: My apologies. I tried your solution and it worked like a charm! All links are based on my local domain.

    Thanks!!

    BTW, where is this documented?

  10. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    Many of the possible defines are listed here:

    http://codex.wordpress.org/Editing_wp-config.php

Topic Closed

This topic has been closed to new replies.

About this Topic