You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Rajkumar s <ra...@gmail.com> on 2005/07/06 21:21:19 UTC

[users@httpd] Help on Rewriting Rule

Dear sir,
           I have a long list of subdomains like "anything.enmail.com"
ie., *.enmail.com

It's a very tedious to set VirtualHost for each and every domain
because there is about 200 domains, so instead can i have a rule to 
fetch the pages from particulardomain/webdir/

If the domains say
ie., one.enmail.com
      two.enmail.com ...

If the web server gets a request as www.one.enmail.com or
one.enmail.com , it should fetch the page from
/home/domains/one.enmail.com/Webdir

And If the web server gets a request as www.two.enmail.com or
two.enmail.com , it should fetch the page from
/home/domains/two.enmail.com/Webdir

 Can anyone help me with the rule or way to achieve this.

Thanks in Advance

S>Rajkumar

---------------------------------------------------------------------
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] Re: Help on Rewriting Rule

Posted by Chris Hall <ch...@gmail.com>.
My apologies, I didn't see that you want to do mass virtual hosts.

On 7/7/05, Chris Hall <ch...@gmail.com> wrote:
> Sounds like a candidate for VirtualHost
> 
> assuming all the domain names point to the same IP address, add
> something like this to your httpd.conf file:
> 
> # x.x.x.x is the server's IP address
> NameVirtualHost x.x.x.x:80
> 
> # virtual host for www.enmail.com and enmail.com
> <VirtualHost x.x.x.x:80>
>     ServerName www.enmail.com
>     ServerAlias enmail.com
>     DocumentRoot /home/domains/enmail.com/Webdir
>     <Directory /home/domains/enmail.com/Webdir>
>         Order deny,allow
>         Allow from all
>     </Directory>
> </VirtualHost>
> 
> # virtual host for www.enmail.in and enmail.in
> <VirtualHost x.x.x.x:80>
>     ServerName www.enmail.in
>     ServerAlias enmail.in
>     DocumentRoot /home/domains/enmail.in/Webdir
>     <Directory /home/domains/enmail.in/Webdir>
>         Order deny,allow
>         Allow from all
>     </Directory>
> </VirtualHost>
> 
> 
> 
> On 7/7/05, Rajkumar s <ra...@gmail.com> wrote:
> > Dear sir,
> >           I had gone through the document about mass defined
> > virtualhosts, i had enabled the module mod_vhost_alias.
> >
> > I want the Webserver to fetch the pages for each request from an
> > directory structure as /home/domains/"domainname"/Webdir
> >
> > if the request is for either http://www.enmail.com or
> > http://enmail.com , the web server should fetch the pages from
> > /home/domains/enmail.com/Webdir.
> >
> > if the request is for either http://www.enmail.in or http://enmail.in
> > , the web server should fetch the pages from
> > /home/domains/enmail.in/Webdir.
> >
> > i also have another type of request to webserver i.e., mail.enmail.com
> > , in this case the webserver should fetch the pages from
> > /home/domains/enmail.com/Webdir/login
> >
> > UseCanonicalName Off
> > VirtualDocumentRoot /home/domains/%2+/Webdir       --- This would
> > fetch www.enmail.com/www.enmail.in
> >
> > VirtualDocumentRoot /home/domains/%1+/Webdir       --- This would
> > fetch enmail.com/enmail.in
> >
> > How can i handly three type of request
> > 1. http://www.enmail.com
> > 2. http://enmail.com
> > 3. http://mail.enmail.com
> >
> > Kindly assist to achieve this.
> >
> > Thanks in Advance
> >
> > S>Rajkumar
> >
> > On 7/7/05, Davide Bianchi <da...@onlyforfun.net> wrote:
> > > Rajkumar s wrote:
> > > > It's a very tedious to set VirtualHost for each and every domain
> > > > because there is about 200 domains, so instead can i have a rule to
> > > > fetch the pages from particulardomain/webdir/
> > >
> > > Sure you can. Read the documentation on apache's web site about
> > > mass-defined virtual host.
> > >
> > > Davide
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >
>

---------------------------------------------------------------------
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] Re: Help on Rewriting Rule

Posted by Chris Hall <ch...@gmail.com>.
Sounds like a candidate for VirtualHost

assuming all the domain names point to the same IP address, add
something like this to your httpd.conf file:

# x.x.x.x is the server's IP address
NameVirtualHost x.x.x.x:80

# virtual host for www.enmail.com and enmail.com
<VirtualHost x.x.x.x:80>
    ServerName www.enmail.com
    ServerAlias enmail.com
    DocumentRoot /home/domains/enmail.com/Webdir
    <Directory /home/domains/enmail.com/Webdir>
        Order deny,allow
        Allow from all
    </Directory>
</VirtualHost>

# virtual host for www.enmail.in and enmail.in
<VirtualHost x.x.x.x:80>
    ServerName www.enmail.in
    ServerAlias enmail.in
    DocumentRoot /home/domains/enmail.in/Webdir
    <Directory /home/domains/enmail.in/Webdir>
        Order deny,allow
        Allow from all
    </Directory>
</VirtualHost>



On 7/7/05, Rajkumar s <ra...@gmail.com> wrote:
> Dear sir,
>           I had gone through the document about mass defined
> virtualhosts, i had enabled the module mod_vhost_alias.
> 
> I want the Webserver to fetch the pages for each request from an
> directory structure as /home/domains/"domainname"/Webdir
> 
> if the request is for either http://www.enmail.com or
> http://enmail.com , the web server should fetch the pages from
> /home/domains/enmail.com/Webdir.
> 
> if the request is for either http://www.enmail.in or http://enmail.in
> , the web server should fetch the pages from
> /home/domains/enmail.in/Webdir.
> 
> i also have another type of request to webserver i.e., mail.enmail.com
> , in this case the webserver should fetch the pages from
> /home/domains/enmail.com/Webdir/login
> 
> UseCanonicalName Off
> VirtualDocumentRoot /home/domains/%2+/Webdir       --- This would
> fetch www.enmail.com/www.enmail.in
> 
> VirtualDocumentRoot /home/domains/%1+/Webdir       --- This would
> fetch enmail.com/enmail.in
> 
> How can i handly three type of request
> 1. http://www.enmail.com
> 2. http://enmail.com
> 3. http://mail.enmail.com
> 
> Kindly assist to achieve this.
> 
> Thanks in Advance
> 
> S>Rajkumar
> 
> On 7/7/05, Davide Bianchi <da...@onlyforfun.net> wrote:
> > Rajkumar s wrote:
> > > It's a very tedious to set VirtualHost for each and every domain
> > > because there is about 200 domains, so instead can i have a rule to
> > > fetch the pages from particulardomain/webdir/
> >
> > Sure you can. Read the documentation on apache's web site about
> > mass-defined virtual host.
> >
> > Davide
> >
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >
> 
> ---------------------------------------------------------------------
> 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
> 
>

---------------------------------------------------------------------
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


[users@httpd] Re: Help on Rewriting Rule

Posted by Rajkumar s <ra...@gmail.com>.
Dear sir,
          I had gone through the document about mass defined
virtualhosts, i had enabled the module mod_vhost_alias.

I want the Webserver to fetch the pages for each request from an
directory structure as /home/domains/"domainname"/Webdir

if the request is for either http://www.enmail.com or
http://enmail.com , the web server should fetch the pages from
/home/domains/enmail.com/Webdir.

if the request is for either http://www.enmail.in or http://enmail.in
, the web server should fetch the pages from
/home/domains/enmail.in/Webdir.

i also have another type of request to webserver i.e., mail.enmail.com
, in this case the webserver should fetch the pages from
/home/domains/enmail.com/Webdir/login

UseCanonicalName Off
VirtualDocumentRoot /home/domains/%2+/Webdir       --- This would
fetch www.enmail.com/www.enmail.in

VirtualDocumentRoot /home/domains/%1+/Webdir       --- This would
fetch enmail.com/enmail.in

How can i handly three type of request 
1. http://www.enmail.com
2. http://enmail.com
3. http://mail.enmail.com

Kindly assist to achieve this.

Thanks in Advance

S>Rajkumar

On 7/7/05, Davide Bianchi <da...@onlyforfun.net> wrote:
> Rajkumar s wrote:
> > It's a very tedious to set VirtualHost for each and every domain
> > because there is about 200 domains, so instead can i have a rule to 
> > fetch the pages from particulardomain/webdir/
> 
> Sure you can. Read the documentation on apache's web site about
> mass-defined virtual host.
> 
> Davide
> 
> 
> ---------------------------------------------------------------------
> 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
> 
>

---------------------------------------------------------------------
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] Help on Rewriting Rule

Posted by Davide Bianchi <da...@onlyforfun.net>.
Rajkumar s wrote:
> It's a very tedious to set VirtualHost for each and every domain
> because there is about 200 domains, so instead can i have a rule to 
> fetch the pages from particulardomain/webdir/

Sure you can. Read the documentation on apache's web site about
mass-defined virtual host.

Davide


---------------------------------------------------------------------
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