How to host one SMF database on two different domains?

Started by sharks, December 20, 2010, 12:30:49 PM

Previous topic - Next topic

sharks

I have a shared account with 2 domains hosted in the same account and i have an SMF 1.1.12 database that i want to be accessible via both these domains, as would two different forums, without a simple redirect. Is that possible? If yes, how to do that?

Kindred

you want the same installation of SMF to be used on two different domains? No share data, just shared files?  Or did you want the same forum, shared files and data?

Either way....  not possible with a base installation.
You can look at the multi-forum mods to try.... but I don't think they do exactly what you described....
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

sharks

I want to have one database and be able to access the forum data from two different domains. Is that possible?

Kindred

not by standard coding....   and I don't know if any of the multi-forum scripts do specifically that....

The problem is that urls and paths are stored directly in the database...   and the urls will obviously be different from each domain.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

flapjack

if you duplicate the paths in the database to store additional settings, it will be possible. There is no such solution available, you'd have to write it from scratch.

Jed11

Quote from: Kindred on December 20, 2010, 01:16:21 PM
not by standard coding....   and I don't know if any of the multi-forum scripts do specifically that....

The problem is that urls and paths are stored directly in the database...   and the urls will obviously be different from each domain.

Where exactly are the urls and paths stored in the database?

Kindred

in a variety of places...  go ahead and look through your database.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Jed11

I set up test site #1 at: mysite.com/test1 and test site #2 at: mysite.com/test2.

I installed one database and pointed both sites at it.

Three of us logged in, registered and posted among ourselves from both sites without issue.  I have no clue how this is being done, but I can assure you it is working and I can find anything not behaving as it should.

I want to connect one of these test sites to my main site, but I afraid to risk messing up my real database by doing so.

Can anyone tell me what the risks are in doing this?

sharks

Quote from: Jed11 on January 13, 2011, 12:22:17 PM
I set up test site #1 at: mysite.com/test1 and test site #2 at: mysite.com/test2.

I installed one database and pointed both sites at it.

Three of us logged in, registered and posted among ourselves from both sites without issue.  I have no clue how this is being done, but I can assure you it is working and I can find anything not behaving as it should.

I want to connect one of these test sites to my main site, but I afraid to risk messing up my real database by doing so.

Can anyone tell me what the risks are in doing this?

I would suggest you upload repair_settings.php and do a screenshot of what you see if all the different paths. That should allow us to better understand how you did it, if you're not being mistaken, that is.

Kindred

I suspect that he is actually mistaken.

If you have two identical forums on the same host, in the same actual domain, how can you tell if the directory being accessed is directory 1 or directory 2?   I am betting that he is actually accessing the second forum, but it is pulling all of the files form forum 1
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

sharks

#10
If i remember right... There's a mod about multi-SMF forums?? Or is that a separate site that offers free SMF forums for all?

I think it would be very interesting if someone could make the code for this concept to work. Let me explain a little bit further...

When you register a domain... suppose www.myforum.com you are usually recommended to register the other variations (on godaddy.com their system automatically recommends and includes discounts) like, myforum.info and myforum.org, etc, etc. Now, you would normally do this, in order to protect your brand, or to avoid your members from getting lost or other rival sites to claim some of your traffic by misdirecting them. Suppose you own only the .com version then a rival could easily register the .org or .net variations and leech some of your site traffic or display something inappropriate at the other address variations.

All that said, this is where the ability of having several domains point to a single SMF database, comes into importance! I hope you all get my point?
Suppose you have registered all the popular variations of your domain but of course, it would be senseless to open a new forum at each of their addresses. So, instead of just redirecting your users, you could have different themes at different addresses, or the ability to further customize the SMF forum at certain addresses. For example, suppose you want to offer the portal version at .info then you can also retain just the plain forum at .com -- and it all runs from a single shared database!

Anyway, i am just trying to illustrate what i am thinking. But all in all, it would certainly be a very clever experience if it was made by someone who understands PHP and SMF. If this concept is made possible, then we could further it by allowing only certain boards to be visible on a domain but on another domain you could show all boards.

Jed11

It's on this site sharks.  I remember reading about it under "Tips and Tricks" ... little short of time right now to search a link.  What I remember is that is was never made into a mod, but required some pretty deep change in the code and only worked on SMF1. 

We played with my two test sites yesterday afternoon and I deleted all at the end of the day, but I could set it back up easily enough. 

Considering what's involved, I also believe it's tricking me into thinking it's working when it's really not actually doing what it appears to be doing.  Although, it surely gives every appearance of being fully functioning. 

Your application example certainly illustrates a worthy purpose of such a mod.  My purpose is a little different.  My website address is getting blocked by one or more corporate networks apparently because of the name of the site.  They are using keywords to eliminate chat sites and forums and my name apparently lends itself to getting marked.  What I want to do is create a clean domain name that doesn't trigger their domain ban so some of my members have access to my boards like they used to.

If you're curious enough about the settings I have, I'll be glad to set it up again tomorrow and post screenshots here for your evaluation.

sharks

Jed11, your problem illustrates yet another solid case where this will come in useful.

I'll look forward to your screenshots. Hopefully i'll be able to make this work on SMF 1.1.12 via manual edits, with an actual sharing of one and same database.

Any potential developer reading this should really pick up this nice idea before someone else does. ;) It's worth it.

Kindred

meh...   I owed all three .net, .com, .org addresses and I just use .htaccess to bounce everyone to the .com address. Much cleaner than trying to support multiple installations.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Illori

well how does that fix the issue of a business blocking one domain and the admin's wish to allow people to still access the board with another url with the same posts/threads?

Kindred

it does not.... however, doing that is tantamount to violating the business internet use rules and should not actually be encouraged, IMO.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

SlammedDime

I think I'm understanding this properly, but just to be sure, let me rephrase it how I understand...

You have two domains both on the same host, both pointing to the exact same set of files...
http://mydomain1.com -> /home/user/public/smf
http://mydomain2.com -> /home/user/public/smf

Right?

And you want both of these to work properly without the urls getting messed up, right?

If that's the case, this is very very very easy to do with NO modifications to SMF whatsoever... it's a built in, hidden, feature.

Simply put the following code into a php file and place it in the root directory of your SMF install it, navigate to it to run it, and then delete it (if it didn't delete itself)... and that's it... your board is now accessible from both urls and will maintain the proper URL as you navigate the site.  Change the URL's to suit your needs of course.  The list of urls should be a comma separated list of urls that are aliases to your main domain.  You can include your main domain (as I would) in the list as well just for easy maintenance in knowing all aliases you use for your board.

<?php

require_once('SSI.php');

updateSettings(array('forum_alias_urls' => 'http://mydomain1.com/path/to/smf, http://mydomain2.com/path/to/smf'));

unlink(__FILE__);


To see the code on how this works, you can check Sources/Load.php, just search for 'forum_alias_urls'
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

SlammedDime

Quote from: Illori on January 13, 2011, 09:12:47 PM
well how does that fix the issue of a business blocking one domain and the admin's wish to allow people to still access the board with another url with the same posts/threads?
In my experience, most businesses that block sites don't do so on a domain basis, they do it on a content basis.  They use some sort of filtering software or external company (OpenDNS, Bluecoat, etc) and these companies index sites and their content and block based on the content of the site.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

sharks

#18
Quote from: SlammedDime on January 13, 2011, 10:20:46 PM
You have two domains both on the same host, both pointing to the exact same set of files...
http://mydomain1.com -> /home/user/public/smf
http://mydomain2.com -> /home/user/public/smf

Maybe i'm missing something... But how to point 2 different domains (assuming they are on the same host) to the same forum files path? Let me explain. I use Cpanel and i have my 2 domains. One is set as the primary domain (the one which i used to register the hosting account with) and the other one is configured via the addon domain feature. Now, when i add another domain, it is installed in its own separate folder. I have set it at the root of my server. So, how could the paths possibly be the same?? Do i need to use repair_settings.php to configure the paths manually? I think i will have to do that, otherwise it will not work. Let me try...

Also, will this method work if the forum files for each of the domains are different (meaning different forum files path but same database)?

SlammedDime

When you add the domain, it asks what file path you want to use, just set it to the public_html folder of your primary domain.

As for different files for different domains, but same database, I don't recommend that.  If you want to run two domains off the same database, use the same set of files.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Advertisement: