[LRUG] [OT:Apache] Mapping multiple domains to different controllers?

Matthew Rudy Jacobs matthewrudyjacobs at gmail.com
Tue Apr 14 03:18:59 PDT 2009


2009/4/14 Murray Steele <murray.steele at gmail.com>:
> Question: why?  Canonical urls and all that.  What's so bad about having a
> redirect from blah.com to pleh.com/blah?  And if that's so bad, what about a
> redirect is so bad, why should blah.com be the same as pleh.com/blah and not
> just make pleh.com/blah redirect to blah.com?

the motivation is the attached diagram (in a horrible flesh colour)

I've built an application in a few hours that does the following;

- an admin controller, for creating new articles
- a /sites/something controller for displaying these articles in one way
- a /sites/something_else controller for displaying these articles in
a slightly different way

The idea being to really quickly host and administer multiple sites
from the same content
but, crucially, when you're inside a hosted site, you're not allowed
to know you're actually in the admin app.

I've done this before in the ruby layer,
namely someone at JGP built a hack into Rails routing that looked at a
requests host, and mapped the request path accordingly,

but that will bypass caching,
and page_caching is super-nice and easy to implement.

If I were being paid to do it, and had time to do it right,
I'd build a two-way SitesAPI,
and host each hosted-site independently

But I thought I'd get away with a quick win,
and get the project finished today.

I guess I need to reassess this,
or maybe try serving static files from Nginx,
then proxying with a rewrite to Apache after the static level.

Anyway,
I better get working.

Thanks for your help.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hosted-sites.png
Type: image/png
Size: 70291 bytes
Desc: not available
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20090414/19cd33e7/attachment.png>


More information about the Chat mailing list