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

  • Home
  • SEARCH
  • 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 7034811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:13:50+00:00 2026-05-28T01:13:50+00:00

I am setting up virtual hosts on two domains. Various sub domains have their

  • 0

I am setting up virtual hosts on two domains.
Various sub domains have their own docroot.

<VirtualHost *:80>
        ServerName *.domain1.com
        VirtualDocumentRoot /var/www/domain1/%1/
</VirtualHost>
<VirtualHost *:80>
        ServerName *.domain2.com
        VirtualDocumentRoot /var/www/domain2/%1/
</VirtualHost>

Accessing

  • http://www.domain2.com

should show

  • /var/www/domain2/www/

but instead it looks for

  • /var/www/domain1/www/

What is going wrong?

  • 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. Editorial Team
    Editorial Team
    2026-05-28T01:13:51+00:00Added an answer on May 28, 2026 at 1:13 am

    I think you need the ServerAlias option that udo mentioned to prevent one VirtualHost from catching everything. Try this:

    <VirtualHost *:80>
            ServerName domain1.com
            ServerAlias *.domain1.com
            VirtualDocumentRoot /var/www/domain1/%1/
    </VirtualHost>
    <VirtualHost *:80>
            ServerName domain2.com
            ServerAlias *.domain2.com
            VirtualDocumentRoot /var/www/domain2/%1/
    </VirtualHost>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running Django using wsgi. I have two domains and one sub domain pointing
I setup, django App with Apache2, 1) Virtual host: <VirtualHost *:80> ServerAdmin webadmin@publisy.com ServerName
I have two virtual hosts within my apache config, one for live and one
Using apache 2, I have a simple virtual host container: <VirtualHost 127.0.0.1> ServerName developmentServer
After setting up Apache virtual hosts with hostnames server1 and server2, how would I
I have a dev server with several virtual hosts on it. Each one needs
I using XAMPP and I have configure it in order to have virtual hosts
My document root is /var/www and I have no virtual hosts enabled. This is
I've got a large Django app. It has two Apache virtual hosts pointing to
On one Linux Server running Apache and PHP 5, we have multiple Virtual Hosts

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.