You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Alexander Skwar <AS...@DigitalProjects.com> on 2002/03/03 10:29:42 UTC
Subdomains with mod_rewrite
Hello all!
I'd like to setup my Apache 1.3.23 so, that it translates subdomain
requests to directories automagically. Let me give you some examples
(the domain name is dom.ain):
Request Redirect
a) http://dom.ain No redirect
b) http://sub.dom.ain http://dom.ain/sub
c) http://foo.sub.dom.ain http://dom.ain/sub/foo
d) http://bar.foo.sub.dom.ain http://dom.ain/sub/foo/bar
e) http://blah.bar.foo.sub.dom.ain http://dom.ain/sub/foo/bar/blah
This means, that if one subdomain is requested, Apache should look for
the files in a folder with the same name as the subdomain (case a)
*sub*.dom.ain -> dom.ain/*sub*).
If two or more subdomains are requested, for the lookup it should
reverse the order of the domainnames and change the '.' to '/' to get
directory delimiters (cases c) to e)).
However, if the HTTP_HOST starts with www., the www. should be ignored
for all the translations.
For the most simple case a) I've got the following rules:
RewriteCond %{HTTP_HOST} ^[^.]+\.dom\.ain$
RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
RewriteRule ^([^.]+)\.dom.ain(.*) /var/www/html/$1/$2
Well, could somebody please help me with the cases c) to e)?
Thanks a lot,
Alexander Skwar
--
How to quote: http://learn.to/quote (german) http://quote.6x.to (english)
Homepage: http://www.iso-top.de | Jabber: askwar@charente.de
iso-top.de - Die günstige Art an Linux Distributionen zu kommen
Uptime: 1 day 0 hours 39 minutes
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Configuring Apache httpd for a RedHat RPM-like layout
Posted by Vasiliy Boulytchev <va...@boulytcheva.com>.
where did you find it?
----- Original Message -----
From: "Ronald Landheer" <ro...@minisat.com>
To: <us...@httpd.apache.org>
Sent: Monday, March 04, 2002 3:03 AM
Subject: RE: Configuring Apache httpd for a RedHat RPM-like layout
> Found it - --wtih-layout=RedHat
> :)
>
> Ronald
>
> > -----Original Message-----
> > From: Ronald Landheer [mailto:ronald.landheer@minisat.com]
> > Sent: Monday, March 04, 2002 10:50
> > To: users@httpd.apache.org
> > Subject: Configuring Apache httpd for a RedHat RPM-like layout
> >
> >
> > Hello all,
> >
> > I'm trying to upgrade by Apache installation on a RedHat 7.2 OOTB
> > install, so I would like to know which config options to use to get the
> > same layout as the one in the RedHat RPMs? (unless ofcourse an RPM or a
> > binary tarball is available)
> > I haven't found what I was looking for by a Google search, so I thought
> > I'd ask :)
> >
> > Greetz!
> >
> > Ronald
> >
> > ---------------------------------------------------------------------
> > The official User-To-User support forum of the Apache HTTP Server
Project.
> > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: Configuring Apache httpd for a RedHat RPM-like layout
Posted by Ronald Landheer <ro...@minisat.com>.
Found it - --wtih-layout=RedHat
:)
Ronald
> -----Original Message-----
> From: Ronald Landheer [mailto:ronald.landheer@minisat.com]
> Sent: Monday, March 04, 2002 10:50
> To: users@httpd.apache.org
> Subject: Configuring Apache httpd for a RedHat RPM-like layout
>
>
> Hello all,
>
> I'm trying to upgrade by Apache installation on a RedHat 7.2 OOTB
> install, so I would like to know which config options to use to get the
> same layout as the one in the RedHat RPMs? (unless ofcourse an RPM or a
> binary tarball is available)
> I haven't found what I was looking for by a Google search, so I thought
> I'd ask :)
>
> Greetz!
>
> Ronald
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Configuring Apache httpd for a RedHat RPM-like layout
Posted by Ronald Landheer <ro...@minisat.com>.
Hello all,
I'm trying to upgrade by Apache installation on a RedHat 7.2 OOTB
install, so I would like to know which config options to use to get the
same layout as the one in the RedHat RPMs? (unless ofcourse an RPM or a
binary tarball is available)
I haven't found what I was looking for by a Google search, so I thought
I'd ask :)
Greetz!
Ronald
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Subdomains with mod_rewrite
Posted by Martin Haase-Thomas <mh...@meome-ag.de>.
Sorry, the last rule has to be
RewriteRule .* $1/$3$2
...
well, maybe...
Martin Haase-Thomas wrote:
> Hi,
>
> maybe this is what you're looking for. I didn't test it at all, but i
> think it should work. Perhaps it will lead apache into a endless loop.
> If it does, append something like "RewriteRule (.*) $1 [L]"
>
> RewriteCond .* (.*)(dom.ain)
> RewriteRule .* $2/$1 [C]
> RewriteCond (.*) (dom.ain)([a-zA-Z0-9_-]*)\.(.*)
> RewriteRule .* $1/$2$3 [N]
>
> Regards
> Martin
>
>
>
>
>
>
> Alexander Skwar wrote:
>
>> Hello all!
>>
>> I'd like to setup my Apache 1.3.23 so, that it translates subdomain
>> requests to directories automagically. Let me give you some examples
>> (the domain name is dom.ain):
>>
>> Request Redirect
>> a) http://dom.ain No redirect
>> b) http://sub.dom.ain http://dom.ain/sub
>> c) http://foo.sub.dom.ain http://dom.ain/sub/foo
>> d) http://bar.foo.sub.dom.ain http://dom.ain/sub/foo/bar
>> e) http://blah.bar.foo.sub.dom.ain http://dom.ain/sub/foo/bar/blah
>>
>> This means, that if one subdomain is requested, Apache should look for
>> the files in a folder with the same name as the subdomain (case a)
>> *sub*.dom.ain -> dom.ain/*sub*).
>>
>> If two or more subdomains are requested, for the lookup it should
>> reverse the order of the domainnames and change the '.' to '/' to get
>> directory delimiters (cases c) to e)).
>>
>> However, if the HTTP_HOST starts with www., the www. should be ignored
>> for all the translations.
>>
>> For the most simple case a) I've got the following rules:
>>
>> RewriteCond %{HTTP_HOST} ^[^.]+\.dom\.ain$
>> RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
>> RewriteRule ^([^.]+)\.dom.ain(.*) /var/www/html/$1/$2
>>
>> Well, could somebody please help me with the cases c) to e)?
>>
>> Thanks a lot,
>>
>> Alexander Skwar
>>
>
--
http://www.meome.de
-------------------------------------------------------
Martin Haase-Thomas | Tel.: 030 43730-558
meOme AG | Fax.: 030 43730-555
Software Development | mht@meome-ag.de
-------------------------------------------------------
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Subdomains with mod_rewrite
Posted by Martin Haase-Thomas <mh...@meome-ag.de>.
Hi,
maybe this is what you're looking for. I didn't test it at all, but i
think it should work. Perhaps it will lead apache into a endless loop.
If it does, append something like "RewriteRule (.*) $1 [L]"
RewriteCond .* (.*)(dom.ain)
RewriteRule .* $2/$1 [C]
RewriteCond (.*) (dom.ain)([a-zA-Z0-9_-]*)\.(.*)
RewriteRule .* $1/$2$3 [N]
Regards
Martin
Alexander Skwar wrote:
>Hello all!
>
>I'd like to setup my Apache 1.3.23 so, that it translates subdomain
>requests to directories automagically. Let me give you some examples
>(the domain name is dom.ain):
>
>Request Redirect
>a) http://dom.ain No redirect
>b) http://sub.dom.ain http://dom.ain/sub
>c) http://foo.sub.dom.ain http://dom.ain/sub/foo
>d) http://bar.foo.sub.dom.ain http://dom.ain/sub/foo/bar
>e) http://blah.bar.foo.sub.dom.ain http://dom.ain/sub/foo/bar/blah
>
>This means, that if one subdomain is requested, Apache should look for
>the files in a folder with the same name as the subdomain (case a)
>*sub*.dom.ain -> dom.ain/*sub*).
>
>If two or more subdomains are requested, for the lookup it should
>reverse the order of the domainnames and change the '.' to '/' to get
>directory delimiters (cases c) to e)).
>
>However, if the HTTP_HOST starts with www., the www. should be ignored
>for all the translations.
>
>For the most simple case a) I've got the following rules:
>
>RewriteCond %{HTTP_HOST} ^[^.]+\.dom\.ain$
>RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
>RewriteRule ^([^.]+)\.dom.ain(.*) /var/www/html/$1/$2
>
>Well, could somebody please help me with the cases c) to e)?
>
>Thanks a lot,
>
>Alexander Skwar
>
--
http://www.meome.de
-------------------------------------------------------
Martin Haase-Thomas | Tel.: 030 43730-558
meOme AG | Fax.: 030 43730-555
Software Development | mht@meome-ag.de
-------------------------------------------------------
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org