Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 121139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:55:21+00:00 2026-05-11T03:55:21+00:00

This is probably an easy question, but I want to understand better how Apache

  • 0

This is probably an easy question, but I want to understand better how Apache works with virtual hosts. I am setting up virtual hosts because I work on multiple websites at once and I don’t want to use subdirectories. I was pretty much using the default Apache httpd.conf file with the DocumentRoot pointing to something like ‘/www’. I uncommented the virtual hosts include and added the following:

 NameVirtualHost *:80  <VirtualHost *:80>     ServerName site1.dev     DocumentRoot /www/site1 </VirtualHost>  <VirtualHost *:80>     ServerName site2.dev     DocumentRoot /www/site2 </VirtualHost> 

Now when I go to http://localhost I get the default page for site1.

I’m sure there is a reason why this makes sense, but I don’t quite understand it. I would’ve thought that only requests that were explicitly to http://site1.test would get routed through that directive and it wouldn’t just become the default. Can someone explain why it becomes the default.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:55:22+00:00Added an answer on May 11, 2026 at 3:55 am

    http://httpd.apache.org/docs/1.3/vhosts/name-based.html

    (Should be true for 2.x also)

    ‘If no matching virtual host is found, then the first listed virtual host that matches the IP address will be used.

    As a consequence, the first listed virtual host is the default virtual host. The DocumentRoot from the main server will never be used when an IP address matches the NameVirtualHost directive. If you would like to have a special configuration for requests that do not match any particular virtual host, simply put that configuration in a container and list it first in the configuration file.’

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably a silly question, but curiosity has gotten the better of me.
This is probably a super easy question, but I just wanted to make 10000%
This is probably easy but I am getting stuck: when I build a solution
This is probably a really easy question, it's just very hard to google a
This is probably one of those easy questions.. I'm trying to redirect the user
This probably has a simple answer, but I must not have had enough coffee
This probably sounds really stupid but I have noo idea how to implement jquery's
Okay, so this probably sounds terribly nefarious, but I need such capabilities for my
Ok, this probably has a really simple answer, but I've never tried to do
Which IoC container is the easiest to get started with. This probably equates to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.