Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

2 Websites with same Vanilla database?

edited November 2011 in Vanilla 2.0 - 2.8
Hi

I want to run 2 separate websites using different domains but pointing to the same Vanilla database. Is this possible? Can someone provide instructions on how to setup?

Thanks in advance...

Best Answer

  • x00x00 MVP
    Answer ✓
    you need to point the domain to the same site.

    well search engines don't like duplicated content so you a going to need to do a 301 redirect, which you can do with .htaccess

    I kind of think you are approaching this wrong though. What you want to do isn't a good idea generally.

    grep is your friend.

Answers

  • ToddTodd Chief Product Officer Vanilla Staff
    There are some things from the db that are cached in the config so there will be some quirks if you have two separate config files that point to the same database.
  • 422422 Developer MVP
    Coudnt you host on one and embed on the other.. Not something i have tried

    There was an error rendering this rich post.

  • What is it that you are trying to to do? You can point two domains to the same site, you could also theme differently based on domain.

    This isn't a federated software. You could run two different set-ups with the same database, but I'm not sure what the point is. I think what you are trying to do may be best served at server level rather than app/framework level.

    grep is your friend.

  • I have pointed two domains to the same forum:

    http://nepali.im and http://supernepal.com

    But this is temporary, as I am in the process of switching my domain from http://nepali.im to http://supernepal.com.

    What is it that you are trying to do? Google doesn't like duplicate contents. So hosting the same site on two domains isn't a good idea, unless you know better.
  • The reason I need to do this is that I have 2 Domain names, 1 is a .com and the other is .in for a similar name. Therefore, rather than create 2 separate forums I wanted to theme each differently but point to same database.

    How can I achieve this?
  • TimTim Operations Vanilla Staff
    You can just configure your webserver to direct both of those domain names to the same installation.

    Vanilla Forums COO [GitHub, Twitter, About.me]

  • I would like to have different themes for each of the sites. If I simply redirect one domain at the other, I don't think this will enable me to do this?
  • ToddTodd Chief Product Officer Vanilla Staff
    Vanilla is just not designed to run multiple sites on the same database out of the box. If you don't want to roll up your sleeves and modify code then I don't recommend you do this.
  • x00x00 MVP
    edited November 2011
    @Todd I notified about the spam, but it is still there.

    @nagrapnagrap changing the theme on the fly should be possible, it is already done with mobile.

    If you override the Theme() function.
     (!function_exists('Theme')) {
    function Theme() {
    if(!IsMobile()){
    $IsHost = stripos(Gdn::Request()->RequestHost(),'mydomain.com')!==FALSE;
    C($IsHost?'Garden.ThemeAlt':'Garden.Theme', 'default');
    }else{
    C('Garden.MobileTheme', 'default');
    }
    }
    }
    stripos(stripos(Gdn::Request()->RequestHost(),'mydomain.com')!==FALSE will match mydomain.com, You need to set ThemeAlt in config.

    I'd avoid editing the core directly.

    You also have the AfterAnalyzeRequest hook, you could set the theme on the fly there.

    grep is your friend.

  • @x00 I hit the Spam button and I think the spammer in the (small) spam queue now

    There was an error rendering this rich post.

  • that should read
    if(!function_exists('Theme')) {

    grep is your friend.

  • x00,

    If I make the above changes as per your comments, then do I also have to setup my hosting to redirect to one of the URLs?

    Currently, say if I have domain xyz.com already setup with Vanilla, but domain abc.com has not been setup at all. Then what other changes do I have to make to domain abc.com so it uses a different theme but points to the same database as domain xyz.com? Is there any changes required within a configuration file?
  • x00x00 MVP
    Answer ✓
    you need to point the domain to the same site.

    well search engines don't like duplicated content so you a going to need to do a 301 redirect, which you can do with .htaccess

    I kind of think you are approaching this wrong though. What you want to do isn't a good idea generally.

    grep is your friend.

  • It would be great if someone could make multiple themes possible. That way, we can have a full blown forum on our domains, and an embed version to put into Facebook
  • The easiest way is to do a theme changer in JavaScript. You can also use a session variable, user meta, and similar code to above.

    grep is your friend.

Sign In or Register to comment.