You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by David Yahoo <da...@yahoo.fr> on 2003/01/12 17:05:49 UTC
[users@httpd] Dynamicly rewrite docroot in vhosts ?
Hi,
I try to rewrite document root judging from subdomain of an host.
All my adresses are qualified in dns.
I m going to explain with sample it's better for understanding.
I think that my challenge is to know how to catch subdomains and add them to the docroot.
But is it possible ?
Let's see :
<VirtualHost *>
DocumentRoot c:/easyphp/www/sites/install/
ServerName install.sites.com
</VirtualHost>
<VirtualHost *>
DocumentRoot c:/easyphp/www/sites/web/
ServerName web.sites.com
</VirtualHost>
I want to take the subdomains of the domains and add it to the document root
I could write only a vhost directive in order to do that.
I d like to take the xxxxxxxxx and put them at the place of the yyyyyyyyyy
<VirtualHost *>
ServerName (xxxxxxxxx).sites.com
DocumentRoot c:/easyphp/www/sites/(yyyyyyyyy)/
</VirtualHost>
Apache is very powerfull but i dont know if it can do this.
I have an apache 1.3.24 win32.
I ve read some pieces of the docs.
I think that my solutions could be a mix of vhost serveralias and rewrite.
I dont understand the serverpath line.
the following adresses give samples :
http://httpd.apache.org/docs-2.0/vhosts/examples.html#serverpath
See what i think, could u help me i m so a great newbie
<VirtualHost *>
ServerName www.sites.com
ServerAlias sites.com *.sites.com
DocumentRoot c:/easyphp/www/sites/
#ServerPath /sites/ # dont know if it could be usual
RewriteEngine On
### make rules to catch subdomains and add them to the docroot ###
### i d only want to catch install and web subdomains
#RewriteRule ^(/sites/.*/.*) c:/easyphp/www/sites/$1/
Options Indexes FollowSymLinks Includes MultiViews
</VirtualHost>
Thanks.
---
Outgoing mail is certified Virus Free.
www.grisoft.com
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 10/01/2003
Re: [users@httpd] Dynamicly rewrite docroot in vhosts ?
Posted by Joshua Slive <jo...@slive.ca>.
On Sun, 12 Jan 2003, Jurgen wrote:
> Hi David,
>
> first you have to get the name of the subdomain. You could accomplish this for example like this:
> RewriteMap lowercase int:tolower
> RewriteCond ${lowercase:%{HTTP_HOST}} (.+)\.domainname.com$
>
> Then in the next line you place %1 where you would like to see the subdomain name:
> RewriteRule ^/(.+)$ c:/www/sites/%1/$1
>
> The $1 contain everything that comes after the domain name, except the first slash.
Or see mod_vhost_alias, which is designed with exactly this task in mind.
Joshua.
---------------------------------------------------------------------
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
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Dynamicly rewrite docroot in vhosts ?
Posted by Jurgen <ap...@squarehosting.com>.
Hi David,
first you have to get the name of the subdomain. You could accomplish this for example like this:
RewriteMap lowercase int:tolower
RewriteCond ${lowercase:%{HTTP_HOST}} (.+)\.domainname.com$
Then in the next line you place %1 where you would like to see the subdomain name:
RewriteRule ^/(.+)$ c:/www/sites/%1/$1
The $1 contain everything that comes after the domain name, except the first slash.
Jurgen
On Sun, 12 Jan 2003 17:05:49 +0100
"David Yahoo" <da...@yahoo.fr> wrote:
> Hi,
>
>
> I try to rewrite document root judging from subdomain of an host.
> All my adresses are qualified in dns.
> I m going to explain with sample it's better for understanding.
> I think that my challenge is to know how to catch subdomains and add them to the docroot.
> But is it possible ?
>
> Let's see :
>
> <VirtualHost *>
>
> DocumentRoot c:/easyphp/www/sites/install/
>
> ServerName install.sites.com
>
> </VirtualHost>
>
> <VirtualHost *>
> DocumentRoot c:/easyphp/www/sites/web/
>
> ServerName web.sites.com
>
> </VirtualHost>
>
>
> I want to take the subdomains of the domains and add it to the document root
> I could write only a vhost directive in order to do that.
> I d like to take the xxxxxxxxx and put them at the place of the yyyyyyyyyy
>
> <VirtualHost *>
>
> ServerName (xxxxxxxxx).sites.com
>
> DocumentRoot c:/easyphp/www/sites/(yyyyyyyyy)/
>
> </VirtualHost>
>
> Apache is very powerfull but i dont know if it can do this.
> I have an apache 1.3.24 win32.
>
> I ve read some pieces of the docs.
> I think that my solutions could be a mix of vhost serveralias and rewrite.
> I dont understand the serverpath line.
>
> the following adresses give samples :
> http://httpd.apache.org/docs-2.0/vhosts/examples.html#serverpath
>
> See what i think, could u help me i m so a great newbie
> <VirtualHost *>
> ServerName www.sites.com
> ServerAlias sites.com *.sites.com
> DocumentRoot c:/easyphp/www/sites/
> #ServerPath /sites/ # dont know if it could be usual
> RewriteEngine On
> ### make rules to catch subdomains and add them to the docroot ###
> ### i d only want to catch install and web subdomains
> #RewriteRule ^(/sites/.*/.*) c:/easyphp/www/sites/$1/
> Options Indexes FollowSymLinks Includes MultiViews
> </VirtualHost>
>
> Thanks.
>
>
> ---
> Outgoing mail is certified Virus Free.
> www.grisoft.com
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.443 / Virus Database: 248 - Release Date: 10/01/2003
---------------------------------------------------------------------
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
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org