.htaccess - DirectoryIndex for subdirectories?

Discussion in 'Tech Support' started by jezmck, 15 Dec 2008.

  1. jezmck

    jezmck Minimodder

    Joined:
    25 Sep 2003
    Posts:
    4,456
    Likes Received:
    36
    My .htaccess file in the root of hosted.jazzle.co.uk contains, amongst other things, the following:

    Code:
    # indexes
    Options -Indexes +MultiViews +FollowSymlinks
    DirectoryIndex ./index.php
    But the second line isn't working how I hoped. (I have included the "./" in the hope that it would use that one file for each subdirectory (recursively).

    The index.php it refers to displays (most of) the contents of that directory, and I wanted to use the same thing for all the subdirectories without duplicating or symlinking the file.

    I have tried a few variants of the above, but don't want to spend too much time if what I want can't actually be done!

    Any suggestions anyone?
     
  2. Doc

    Doc oops.

    Joined:
    15 Dec 2008
    Posts:
    50
    Likes Received:
    0
    You don't need the ./, by default apache will always look for any of the index files you list in the current folder (whether you're browsing in / or /stuff/ or /stuff/morestuff/, etc.)

    For example:

    DirectoryIndex index.php index.html index.htm

    This will look for index.php (in the current directory) first, then look for the other two. Another way to do it:

    DirectoryIndex index.php index.html /index.php

    This example will look for both index.php and index.html in the current directory, and if it doesn't find either, it'll look for index.php at the root of your website (i.e a frontpage).

    Hope that helps!
     
  3. jezmck

    jezmck Minimodder

    Joined:
    25 Sep 2003
    Posts:
    4,456
    Likes Received:
    36
    Thanks.
    this is what I thought but it doesn't seem to be the case, hence me trying the Options stuff.

    Any idea what else could be blocking this behaviour?
     

Share This Page