Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


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 learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses
Course of the Month10 days, 13 hours left to enroll

618 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