Apache defaulting to index.html - Don't want it to :(

Discussion in 'Apache' started by ExTexan, Dec 20, 2008.

  1. #1
    I'm running Apache 2.2 on WinXP as a local server for testing several development projects. I have 3 sites that I have set up as Virtual Hosts in the Apache conf files - for example:

    Site 1 Virtual host: site1.lcl Home page: index.html
    Site 2 Virtual host: site2.lcl Home page: index.php
    Site 3 Virtual host: site3.lcl Home page: index.htm

    Using a Firefox add-on, I have two links for each site, like this:

    http://site1.lcl - shud show a listing of files in the site root (so I can run "extra" utility php scripts)
    http://site1.lcl/index.html - shows the home page (so I can test the site)

    That approach is working great for sites 2 and 3 (.php and .htm), but site one (with home page of index.HTML) is not working. The link for the directory listing (site1.lcl) is loading the index.html page instead of showing the files in the directory. I found the following in my httpd.conf file:

    
    <IfModule dir_module>
        DirectoryIndex index.html
    </IfModule>
    
    Code (markup):
    ...and tried commenting it out (with #). That didn't work.

    I tried changing index.html to xxx.html (with those lines UNcommented). That didn't work.

    I went to my site root and renamed the index.html to index.htm - That WORKED!!!

    I searched my entire Apache directory tree for .htaccess files - none found. But it seems *something* is still telling Apache to default to index.html. I searched the forums and found lots of entries where people where having problems with it NOT finding their index.html (or .php or .htm or whatever), but I can't get it to NOT find mine. :(

    Thanks in advance for any help you can offer.
     
    ExTexan, Dec 20, 2008 IP
  2. SSANZ

    SSANZ Peon

    Messages:
    861
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    did you have the .HTML is high case or lower case?

    Ive come across some itchy issues related to this, and it turns out they had the .html in .HTML.

    You can change the index config within httpd.conf afaik.
     
    SSANZ, Dec 20, 2008 IP
  3. ExTexan

    ExTexan Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    No, it was in lower case - I only typed it like that to point out what the problem was. Sorry for the confusion.

    All of what I've tried has been done in the httpd.conf file. Other than the .htaccess files (which I don't find anywhere in the Apache folder tree), is there some other place I should look?
     
    ExTexan, Dec 21, 2008 IP
  4. ExTexan

    ExTexan Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    So, does anyone have any ideas on this? I haven't found a solution yet. :(
     
    ExTexan, Dec 23, 2008 IP
  5. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #5
    DirectoryIndex your_desired_index-filename.html


    that simple one line should do the job
    in your .htaccess in your webspace / or the particular folder you want it to act
    if apache config allows overriding ( allows .htaccess )
     
    hans, Dec 28, 2008 IP
  6. phper

    phper Active Member

    Messages:
    247
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #6
    Just change your DirectoryIndex to a file that doesn't exist.
    e.g.:
    DirectoryIndex xxxwhateverxxx.html

    The default file will not be found so it will list the content of the directory (assuming the option 'Indexes' is not disabled).

    Note that if you make the change in your httpd.conf file you'd need to restart Apache in order to get the changes applied. Also, to make sure you are not opening a cached version of the file, always do hard refresh: press the CTRL key while clicking on the refresh/reload button (or F5).
     
    phper, Dec 28, 2008 IP