multiple sites but without multi-tenant?

Topics: Administration, General
Feb 28, 2012 at 3:56 AM

If I have many sites and each has distinct content with no overlap between them, is multi-tenant the only (out-of-the-box) option?  I'm hoping to treat the sites as if they were all part of a single 'tree' of content without having to manage N (for N around 1000) different sites.  The table-prefix-per-site seems like it could be kind of a maintenance issue with a large number of different sites as well.

Thanks!

Coordinator
Feb 28, 2012 at 6:28 AM

If you want to manage them as one site, then what you really have is one site with many sections and you should not use multi-tenancy. Instead, you would have maybe a custom theme provider that switches the theme based on what section of the site the user is on.

Feb 28, 2012 at 12:28 PM

You can possibly use Url Rewriting to achieve this. It's something I've been wanting to write a module for (there have been a couple of discussion threads around the topic, basically "Multiple Domains" vs "Multiple Tenants") but not actually had the need yet.

Feb 28, 2012 at 4:01 PM
bertrandleroy wrote:

If you want to manage them as one site, then what you really have is one site with many sections and you should not use multi-tenancy. Instead, you would have maybe a custom theme provider that switches the theme based on what section of the site the user is on.

Makes sense, but the mapping to multiple hostnames is what I'm trying to figure out options for.  IOW, without multiple tenant, what's the closest thing to being able to create content at not just a relative path, but at a hostname + path?

The only thing I could think of so far was to make the hosts into folders, so the site would actually 'exist' and be managed as:

  • http://localhost/www.foo.com/*
  • http://localhost/www.bar.com/*
  • http://localhost/www.baz.com/*

and then use URL rewrite so incoming urls are rewritten from http://host/path to http://localhost/host/path.

This seems like it would work, but I'm a little worried about it since that means having to rewrite outbound url's as well.

Having Orchard set up to more 'natively' handle the multiple hosts as separate content areas (but not completely separate like multi-tenant, since AFAICT that would make sharing things across hosts more difficult) I guess is the goal (although I'm not yet familiar enough with Orchard to know if I'm even thinking of it the right way yet :)

Certainly custom code can make this work in multiple ways, but I'm trying to minimize how much is done custom (which is why multi-tenant is so attractive, as it's in the box and supported :)

Feb 28, 2012 at 4:11 PM
randompete wrote:

You can possibly use Url Rewriting to achieve this. It's something I've been wanting to write a module for (there have been a couple of discussion threads around the topic, basically "Multiple Domains" vs "Multiple Tenants") but not actually had the need yet.

Yeah, Url Rewriting does seem like it would work, but it always feels a little hacky since it has to rewrite the outgoing html content to fix the links.  For instance, an outgoing link of http://localhost/www.foo.com/images/bar.jpg getting rewritten to http://www.foo.com/images/bar.jpg (and then the trickier ones for outgoing relative urls)

If you end up making the module, please let me know, as I'd love to try it out! :)

Feb 28, 2012 at 4:34 PM

URL rewrite is the closest thing right now to what you're looking for, and yes it has the disadvantage of having to rewrite outbound URLs (although ... this will be a big obstacle in attempting to implement something more natively, due to the way Urls are generated by MVC, and it's one of the main reasons I haven't written the module myself yet!)

Feb 29, 2012 at 2:23 AM
randompete wrote:

this will be a big obstacle in attempting to implement something more natively, due to the way Urls are generated by MVC

I'm a routing n00b, but does this mean (or refer to) the routes not including a particular host header to match against?  If so, something akin to this example of subdomain routing would seem to work, at least in terms of getting the host into the route data.  If Urls are being generated in Orchard via route names, then I wonder if rewriting the routes per request would work (although there's likely a better option :)

Not knowing the pipeline very well, is there anything available (driver? filter? not sure) for 'plugging into' the Url generation?  At least that would let us avoid the parsing out and fixing up of links in post-rendered html :)