Hi Steffen,
one way would be to create a separate virtual server for each subdomain you want.
Change it's default rule to the Reverse Proxy handler, aiming it at domain.com/subdomain and you should be ready to go.
When matching your virtual server against (.+)\.domain\.com$ you should be able to do the same within a single virtual server. You need a rule that redirects internally to
http://domain.com/^1/$1 or so.
regards
Ringo
-----Original Message-----
From: cherokee-bounces@lists.octality.com [mailto:cherokee-bounces@lists.octality.com] On Behalf Of Steffen Schneider
Sent: Wednesday, September 07, 2011 1:26 PM
To: cherokee@lists.octality.com
Subject: Re: [Cherokee] Internal redirection based on subdomain
Hi Alvaro,
thanks for the reply, that was really quick :)
I've read the redirs cookbook and handlers redir examples mutiple
times now, but
somehow I don't seem to get it right :(
I can set up external redirects just fine, so "sub.domain.com" 301-redirects
to "domain.com/sub" (browser changes URL as well)
What I need is an "internal redirect" or "rewrite", so the browser stays
at "sub.domain.com" (no 301) and only internally is served from
"domain.com/sub"
Here's my setup, maybe you can point me to where my limitations are?
Host Match for virtual host:
^(.*)\.domain\.com$
Rule:
Header->Host->matches regex: ^(.*)\.domain\.com$
Handler:
RegEx ^(.*)$
Substitution
http://domain.com/^1$1
As long as the handler type is external, this does a correct 301 redirect
(which I don't want): test.domain.com - 301 -> domain.com/test
But when I then switch the handler type to "internal" I just get "500
Internal Server Error"
so that seems to be the place where I am stuck...
Thank you so much!
--
Steffen
- Hide quoted text -
On Wed, Sep 7, 2011 at 07:42, Alvaro Lopez Ortega <alvaro@octality.com> wrote:
> Hello Steffen,
>
> On Wed, Sep 7, 2011 at 12:19 AM, Steffen Schneider <sts@indoblo.com> wrote:
>>
>> I'm having a tough time setting up an internal redirection based on
>> the subdomains:
>>
>> sub.domain.com -> domain.com/sub
>>
>> I've managed to set up an external redirection just fine, but that's
>> not excatly what I need :-/
>> It would be more of a "rewrite", so the browser keeps showing
>> "sub.domain.com".
>>
>> There must be a way to do this, as with any other webserver,
>> would somebody enlighten me on this one?
>
> You have to use the ^-replacements. Please, this documentation page for
> details - specially the “Global redirections†section.
> Cheers!
>
> --
> Greetings, alo
> http://www.octality.com/
>
_______________________________________________
Cherokee mailing list
Cherokee@lists.octality.com
http://lists.octality.com/listinfo/cherokee _______________________________________________
Cherokee mailing list
Cherokee@lists.octality.com
http://lists.octality.com/listinfo/cherokee