Apache Server configuration support - VirtualDocumentRoot - using www/mydomain.com/ for both mydomain.com and www.mydomain.c

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > July 2005 > VirtualDocumentRoot - using www/mydomain.com/ for both mydomain.com and www.mydomain.c





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author VirtualDocumentRoot - using www/mydomain.com/ for both mydomain.com and www.mydomain.c
doogle

2005-07-29, 6:15 pm

Hi,

I'm a complete newbie to apache (and Unix). Please forgive my
ignorance.
Am trying to have "Automatic Virtual Hosts" - meaning I am setting my
DNS to direct multiple domains:
domain1.com
domain2.com
to the IP of my Apache machine, as well as their respective www
subdomains:
www.domain1.com
www.domain2.com
to the same IP address.
I want to have on my server folders for each domain:
www/domain1.com/
www/domain2.com/
and I want Apache to give the content of www/domain1.com/ to a user
requesting domain1.com.
I wish it to be done automatically and not set it per domain (lots of
domains).
Managed to do it so far using:
VirtualDocumentRoot /www/%0
But it's working only for the domain itself and not for the www
subdomains, for which I get 404.
Tried:
RewriteRule www\.(.*\.\w{2,})\/(.*) $1/$2
With no success.
Please advise...
(Would appreciate as much explanations about the solution as possible
as I'm a complete ignorant and wish to understand)

Thanks!

P.S.
What if some of my domains may be of the form:
www.subdom.domain1.co.uk
I do NOT wish to map those to /subdom.domain1.co.uk/ or to
/domain1.co.uk/, only www of TLD's (or cc TLD's), not of subdomains...
Will I have to add a RewriteCond with the regex for the format I would
like to rewrite?

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com