Can I use diffrent DirectoryIndex in the same VirtualHost?

Discussion in 'Apache' started by wergeni, Mar 25, 2010.

  1. #1
    I would like to use different DirectoryIndex within the same VirtualHost, is that possible?

    I could obviously just set up a new VirtualHost with the DirectoryIndex I need but then I need to remember to update all my virtualhost's when I make any changes.

    Something like:
    <VirtualHost *:80>
    ServerName domain1
    DirectoryIndex index1.php

    ServerAlias domain2
    DirectoryIndex index2.php

    DocumentRoot "/same for all domains/"
    //// general settings ////​
    </VirtualHost>

    regards
    Wergeni
     
    wergeni, Mar 25, 2010 IP
  2. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #2
    You can use DirectoryIndex in an .htaccess file per-directory
     
    zacharooni, Mar 27, 2010 IP
  3. cameleon

    cameleon Greenhorn

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    Ofcourse you can, i have made portal with 20domains pointing to same one.
     
    cameleon, Mar 28, 2010 IP