Dynamic subdomains to different vhosts

Posted on 2004-04-05
Medium Priority
Last Modified: 2010-03-04
With our current hanrdware setup, all the traffic goes through 1 IP address. We would like www.domain.com and domain.com to goto the standard directory (ie, /home/domain). All the dynamic subdomains (ie: foo.domain.com, bar.domain.com) should all point to /home/dynamicdomain/. How can I accomplish this?
Question by:dcman99
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

rrusch earned 1000 total points
ID: 10761538
For Apache you just need a default virtualhost section. Normally the first in httpd.conf.
Additionally dns has to resolve *.domain.com to your ip.

--- Example httpd.conf ---
NameVirtualHost *
<VirtualHost *>
        DocumentRoot /home/dynamicdomain

<VirtualHost *>
        ServerName www.domain.com
        ServerAlias domain.com
        DocumentRoot /home/domain
LVL 10

Assisted Solution

Mercantilum earned 1000 total points
ID: 10857009
To my mind something is missing in the answer above,
<VirtualHost *>
        ServerName foo.domain.com
        ServerAlias bar.domain.com xxx.domain.com
        DocumentRoot /home/dynamicdomain

This way the 3 subdomains foo.domain.com, bar.domain.com and xxx.domain.com point to /home/dynamicdomain
LVL 10

Expert Comment

ID: 10857014
And remove
<VirtualHost *>
        DocumentRoot /home/dynamicdomain
LVL 15

Expert Comment

ID: 11760893
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:

    SPLIT: rrusch, Mercantilum

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

EE Cleanup Volunteer

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question