Virtualhost setup, same IP address, different DirectoryIndex's

Posted by kaykills on Server Fault See other posts from Server Fault or by kaykills
Published on 2012-10-24T15:46:01Z Indexed on 2012/10/24 17:03 UTC
Read the original article Hit count: 298

Filed under:
|

I am trying to set up 2 virtual host entries in apache but I'm not sure how to accomplish what I want to do. I have two domain names, both pointing to the same IP Address. I need the DirectoryIndex to be different, which is pretty much the only difference in the entries. I have the following set up:

<VirtualHost *:80>

    ServerName firstdomain.com
    ServerAdmin [email protected]
    DocumentRoot "/srv/www"
    DirectoryIndex  /portals/site/index.html

</VirtualHost>

<VirtualHost *:80>

    ServerName seconddomain.com
    ServerAdmin [email protected]
    DocumentRoot "/srv/www"
    DirectoryIndex  /portals/site/index_fr.html

</VirtualHost>

Not sure what I need to do differently but the second entry doesn't work. The only real difference is I need the second domain to point to a different DirectoryIndex. If there is a better way to accomplish this, your help would be appreciated.

© Server Fault or respective owner

Related posts about apache2

Related posts about virtualhost