News:

Wondering if this will always be free?  See why free is better.

Main Menu

Multidomain SMF forum

Started by Pedja, May 15, 2007, 11:34:41 AM

Previous topic - Next topic

Sarge

Quote from: cjexotic on February 17, 2008, 02:46:25 AM
But I'm trying to use different domain names and their URLs  if possible.

I'll see what I can do about that. :)

Just don't hold your breath, though... I need to test and release another major beta version (0.3) that will use its own tables and support a (quite popular) mod for subforums. I'll see about subdomains after that.

    Please do not PM me with support requests unless I invite you to.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting


mdp

Okay,

When I first tried this tutorial and got this error message:
QuoteFatal error: Call to undefined function: loaddomain() in /home/wildhogs/public_html/index.php on line 145

I still can not understand why I am getting this message.  I followed exactly what was instructed and not get much of help here so I gave up and went on to do my own integration and was success.  That is until I purchased SMF Gallery Pro and that totally changed everything.  Things got screwed.  Now I can not go back to same way because I don't really remember how it was done because SMFHacks changed it few months ago and didn't tell me.  Oh well, such is life!

So now I am back to this again and now guess what?  Again, I followed instruction and again I am getting same error message:

QuoteFatal error: Call to undefined function: loaddomain() in /home/wildhogs/public_html/index.php on line 145

How can loaddomain() and loadDomain() be different??  Unless I am blind, I don't find any loaddomain() in the code :D

Also, where am I supposed to add the smf_domain_forums database into?  The primary or the secondary?

Just an idea??  How about just attaching the files where modification are changed for 1.1.4?  1 for simple mods and another for the whole including changing categories and etc.  So I can go ahead and upload the files overwritting existing one.  If you do, just add it to the first post of this thread.  Thanks!

capnken

Hey guys - running Pedja's Multidomain and loving it. Absolutely great mod.

And now I'm in to tweaking out some fairly minor conflicts. And one of those is Calendar display of upcoming events. I show them on home pages and unread posts pages. The issue is that when somebody puts an event in a board that's restricted to Site A and also puts the event in a board that's restricted to Site B, it shows up twice in the home page upcoming events listing.

The duplicate events do not show up in the full calendar display, only in the upcoming events display on the home page and unread posts.

So what I need to do is also restrict calendar display in the upcoming events by the boards associated with the site. I've poked around different source files and can't figure out what's controlling the display on the full calendar and/or how to implement that on the display of upcoming events.

Any advice is appreciated.

mdp

he doesn't reply to my post so I guess no need for me to subscribe anymore..

perplexed

can someone show me some examples of this working?

What I want to do is mirror one of my forums so that it is accessible from different domain addresses (rather than just a link to the forum on one domain)

For example if the forum I wanted to mirror was http://www.fishingsite.com/forum

It would then appear as

http://www.fishingsite.com/forum   
http://www.huntingsite.com/forum
http://www.birdwatching.com/forum

It would all be the same forum but when you were in it, it would have the address for each domain as above, rather than being a redirect to http://www.fishingsite.com/forum on each different domain.

We do this at work, have the same site but one is in the US .com and mirrored on .co.uk so it that what this will do?


SleePy

I am not sure if Sarges mod is quite what you are looking for. His mod allows you to run multiple forums under multiple domains from a single SMF install using the same database and everything.

But I assume you mean things like these?
http://lordsofclantribe.com/index.php
http://www.lordsofclantribe.com/
http://brainstemgames.com/community/ (Note that after some time this link will not truely work due to changes we are doing).

I got more links. But those are the most common ones I remember off the top of my head.

What I did is in my Settings.php I have an array of valid domains.
I then set a default url (the first one I linked) under $boardurl_default.
Then I check to see if we are using a valid domain. If we are I replace out the default boardurl with the new one.
I repeated this same step in Load.php for my ModSettings and Settings so my theme urls change as well.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Sarge

Quote from: SleePy on April 03, 2008, 09:46:15 PM
I am not sure if Sarges mod is quite what you are looking for. His mod allows you to run multiple forums under multiple domains from a single SMF install using the same database and everything.

It's not there yet :) My mod allows you to run one forum, but make it look like several forums, using a single domain. I plan to add a moultidomain feature in later versions.

    Please do not PM me with support requests unless I invite you to.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting

perplexed

Quote from: SleePy on April 03, 2008, 09:46:15 PM
I am not sure if Sarges mod is quite what you are looking for. His mod allows you to run multiple forums under multiple domains from a single SMF install using the same database and everything. 

Not quite there yet, I already checked with him

Quote from: SleePy on April 03, 2008, 09:46:15 PM
But I assume you mean things like these?
http://lordsofclantribe.com/index.php
http://www.lordsofclantribe.com/
http://brainstemgames.com/community/ (Note that after some time this link will not truely work due to changes we are doing).

Yes that looks like what I want to achieve :)

Quote from: SleePy on April 03, 2008, 09:46:15 PM
What I did is in my Settings.php I have an array of valid domains.
I then set a default url (the first one I linked) under $boardurl_default.
Then I check to see if we are using a valid domain. If we are I replace out the default boardurl with the new one.
I repeated this same step in Load.php for my ModSettings and Settings so my theme urls change as well.

So you didn't use the info in first post of this thread?  Can you give me more details please on how to set this up how you did it?  It sounds simpler but that might be me not understanding it.  I'd like to try it out.

Thanks Sleepy!



SleePy

oh sorry. I keep forgetting to do this when I am at home.. I will email this to myself and get it tonight.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!


SleePy

#52
Ok..

In another file I have an array of domains, but they could be in your settings.php I have them in another file so other parts of my site can take advantage of the multiple urls as well easier.

$domains = array(
'lordsofclantribe.com' => false,
'brainstemgames.com' => true,
);

// Enables www urls.
foreach ($domains as $dom => $enable_www)
    if ($enable_www)
        $domains['www.' . $dom] = $enable;


Well in my Settings.php In place of my $boardurl I did:
$boardurl = 'http://lordsofclantribe.com';
$boardurl_default = $boardurl;
if (isset($Site['domains'][$_SERVER['HTTP_HOST']]) && substr($_SERVER['HTTP_HOST'], -20) != $boardurl_default)
    $boardurl = 'http://' . $_SERVER['HTTP_HOST'] . '/community';


Then in Load.php at the end of the loadTheme function I added:

    global $Site, $boardurl_default;
    if (isset($Site['domains'][$_SERVER['HTTP_HOST']]))
    {
        $sub_folder = '';
        if (substr($_SERVER['HTTP_HOST'], -20) == $boardurl_default)
            $sub_folder = '/community/';

        foreach($settings as $key => $value)
            $settings[$key] = str_replace($boardurl_default, 'http://' . $_SERVER['HTTP_HOST'] . $sub_folder, $value);

        foreach($modSettings as $key => $value)
            $modSettings[$key] = str_replace($boardurl_default, 'http://' . $_SERVER['HTTP_HOST'] . $sub_folder, $value);
    }


Edit as needed :)
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

perplexed

#53
thanks sleepy I'll go try this out.


edited:  Ok I think I did it right but I guess not.  I have an 'undefined variable notice' at the top of my original forum which points to the domain code I put in settings.php (the part you have in a separate file)


I have an internal server error on one of the mirror urls and a 'nothing found' on the third one

Can I check, if you were going to put the domains array file into the settings file how would you do it?

Also can I check exactly where you put the third bit of code in load/php.  I may have it in the wrong place, I wasn't sure where function load theme ended, there's a lot in there.

Do I have to do anything on the other two additional domains to make this work?


Just to make sure...

my original forum (the one I want mirrored) is at http://www.domain1.com/forum

I have two more domains which have wordpress installed in the root and nothing else there

http://www.domain2.com
http://www.domain3.com

I would like when you got to url http://www.domain2.com/forum and http://www.domain3.com/forum that it would take you to the original forum but display the URL as domain2 or domain3 forum address and not http://www.domain1.com/forum

SleePy

What code was on that line that had the error?

As for the load theme
You can tell where it ends because it does
}

function xxxx ([...])
{

And starts on the next function.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

perplexed

#55
It was this line

$domains['www.' . $dom] = $enable;

Notice:  Undefined variable: enable in /home/domain1/public_html/forum/Settings.php on line 39 

I added it like this before the forum info

########## Domain Info ##########
$domains = array(
'domain1.com' => false,
'domain2.com' => true,
);

// Enables www urls.
foreach ($domains as $dom => $enable_www)
    if ($enable_www)
        $domains['www.' . $dom] = $enable;


I'll try it again this morning (see above, tried got same prob, but I'm probably not doing it right)

My original forum I wanted mirrored is http://www.domain1.com/forum

I want it to be mirrored at

http://www.domain2.com/forum
http://www.domain3.com/forum

Both domain2 and domain3 have wordpress installed in root and nothing else so far.

Paracelsus

Quote from: SleePy on April 07, 2008, 09:37:37 PM
Ok..

In another file I have an array of domains, but they could be in your settings.php I have them in another file so other parts of my site can take advantage of the multiple urls as well easier.

$domains = array(
'lordsofclantribe.com' => false,
'brainstemgames.com' => true,
);

// Enables www urls.
foreach ($domains as $dom => $enable_www)
    if ($enable_www)
        $domains['www.' . $dom] = $enable;


Well in my Settings.php In place of my $boardurl I did:
$boardurl = 'http://lordsofclantribe.com';
$boardurl_default = $boardurl;
if (isset($Site['domains'][$_SERVER['HTTP_HOST']]) && substr($_SERVER['HTTP_HOST'], -20) != $boardurl_default)
    $boardurl = 'http://' . $_SERVER['HTTP_HOST'] . '/community';


Then in Load.php at the end of the loadTheme function I added:

    global $Site, $boardurl_default;
    if (isset($Site['domains'][$_SERVER['HTTP_HOST']]))
    {
        $sub_folder = '';
        if (substr($_SERVER['HTTP_HOST'], -20) == $boardurl_default)
            $sub_folder = '/community/';

        foreach($settings as $key => $value)
            $settings[$key] = str_replace($boardurl_default, 'http://' . $_SERVER['HTTP_HOST'] . $sub_folder, $value);

        foreach($modSettings as $key => $value)
            $modSettings[$key] = str_replace($boardurl_default, 'http://' . $_SERVER['HTTP_HOST'] . $sub_folder, $value);
    }


Edit as needed :)

Sleepy,

Does this solution tackle that problem of inter-domain cookies? Because right now I have two domains and one is 'parked' to the other, but the impossibility of having the same cookie in both domains leads to automatic logout when you close the browser in the parked one, plus once you do the login the domain changes to the 'original'.

Btw, how is this solution 'seen' by google, since I've read lots of articles recommending 301 redirects to avoid duplicate content, but I would prefer try something else instead of redirecting.

SleePy

This won't solve the cookie issues. It really isn't a cookie issue more than security at play. Security is preventing other domains from accessing cookies to domains it doesn't have access to. since domain.com is different than domain.net it doesn't allow this.

There are a few tricks (one I just learned about yesterday from a charter member) to get around this. But I haven't actually tried this to or worried to much about it. I rather keep my security than worry about having users logged in across multiple domains (in time I am going to be splitting these up so we won't have worry about it).

I haven't done case studies or anything on this to see how it affects google or other search engine rankings, I am not to caring if google doesn't like it as I said I do plan on changing this in the future so it will be fixed up some day.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

perplexed

hi sleepy can you have another look at my last post when you get time, I still can't get it to work

thanks

SleePy

Ahh sorry.
Change it to
$domains['www.' . $dom] = $enable_www;

I cleaned up the code  a little (since I was doing detection for different folders) and made a typo there :P

That code basically appends www. to all your domains so you don't have to duplicate domains with a useless www. addition. It only does it if you have the variable set to true.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Advertisement: