Multiple sites with one db

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
1/3/2007 4:12:00 AM
Gravatar
Total Posts 41

Multiple sites with one db

Hi!

Is it possible to have multiple sites with one database? What do I need to do to make this work?

I'm using a web provider. Can only have one database but several web sites.

Thanks.

1/4/2007 2:49:31 AM
Gravatar
Total Posts 18439

Re: Multiple sites with one db

Hi Emil,

Yes that should work fine.
1. Use the same connection string in all sites.
2. in the first site set the Web.config "AllowMultipleSites" = true
3. Now both sites are the same content, to make the new site have its own content go to the first site in Admin > Site Settings. You'll see a dropown next to the site name, choose "New Site", give the new site a name and click save.
4. Now more controls show up at the bottom of the page to configure the host name for the new site and which features to include. Add a host name that points to the second site and now it is independent, it no longer shares data with the first site.

I just updated the documentation for this here:
http://www.mojoportal.com/muliplesites.aspx

Please let me know if the documentation is unclear or any feedback to improve it.

Thanks,

Joe
1/5/2007 3:01:10 AM
Gravatar
Total Posts 18439

Re: Multiple sites with one db

Oh, I thought of something else you will need to do to make this work. When you create the second (or nth) site using the Admin > Site Settings of the first site, it will create a folder in the first site at Data/Sites/[new site id], so the second site will be Data/Sites/2 and the 3rd site will be Data/Sites/3 and so on. Since the additional sites are using their own web installation you will need to copy these folders to the correct location in the additional sites because by default there is only 1 folder at Data/Sites/1.

Hope it helps,

Joe
2/3/2007 4:20:58 PM
Gravatar
Total Posts 21

Re: Multiple sites with one db

I'm doing something simular..

but have a question about how to do it with medium trust set :P

from the docs.. its saying not to use the same code base..

but when I tried to create a second mojo directory, for a second site. but using the same DB.. it shows the content of my first site.

Thanks for any assist :)

2/3/2007 5:09:33 PM
Gravatar
Total Posts 18439

Re: Multiple sites with one db

Multiple sites using 1 installation is not supported under medium trust. It won't work because the VirtualPathProvider which is needed to provide each site its skins theme file doesn't work and because the search index is fixed to a single folder not a site specific folder, and maybe other reasons as well.

Joe
2/3/2007 5:21:18 PM
Gravatar
Total Posts 21

Re: Multiple sites with one db

so I can't use 2 seperate installations and only 1 DB?

I knew that it didn't work with one installation of the code base, so I tried to make it work with 2 code bases, but using the same DB.

2/3/2007 5:26:42 PM
Gravatar
Total Posts 18439

Re: Multiple sites with one db

No it should work with one db as long as you specify a host for the second site. It does require 2 web sites though each with its own web.config.

Joe
2/3/2007 5:30:34 PM
Gravatar
Total Posts 21

Re: Multiple sites with one db

that's what I have configured at the moment..

1 DB..

2 Seperate directorys

  • mojo
  • mojoRT

but when I hit the URL for the second one, which is pointed at the mojoRT directory it's still displaying all the content for the first site.

I created a new siteID and all, but I'm just not seeing how to associate that new id to the URL

and thanks for the quick replies.. I thought I was the only one demented enough to do this stuff on the weekends :)

2/3/2007 5:46:03 PM
Gravatar
Total Posts 18439

Re: Multiple sites with one db

No it doesn't work with localhost/mojo and localhost/mojoRT because it requires separate host names and in this case the host name is localhost.

It will work with localhost/mojo and someotherhost/mojoRT

If you have control of the server you can add a host name in Windows\System32\drivers\etc\hosts file
You will see in there

localhost 127.0.0.1

just add

someotherhost 127.0.0.1

Joe
2/3/2007 5:50:22 PM
Gravatar
Total Posts 21

Re: Multiple sites with one db

actually what I have is to unique domain names one going to each directory.

so not using localhost at all

when I try to send the domain directly to the mojoRT directory, I get an error saying default.aspx not found.. (or something simular to that)

so what I have to do, is in the root of the web site on the providor use a ASP script to redirect to the appropriate directory depending on the domain url in the request object.

2/3/2007 5:56:31 PM
Gravatar
Total Posts 18439

Re: Multiple sites with one db

If the domains actually point to the separate directories you shouldn't need any redirecting. This sounds like the same issue you had with the first site. Are you sure all the files made it to the 2nd site?

Joe
You must sign in to post in the forums. This thread is closed to new posts.