Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Why won't Apache website subdirectories load index.php unless explicitly requested?

I am setting up an Apache server. There is a main site and if I use the URL http://www.mainsite.com/ (with mainsite subbing for real name) it loads the index.php page just fine.

The site has a subdirectory that also contains an index.html and index.php page. In Firefox, if I specify the URL http://www.mainsite.com/subdir then I get redirected to http://www.com/

In IE, an error says The Page Cannot be Displayed

Yet, if I specify http://www.mainsite.com/subdir/index.php then the index page loads fine.

httpd.conf specifies the directory index directive as:

DirectoryIndex index.html index.php index.htm

I even tried putting in a .htaccess file with a "DirectoryIndex index.php" directive, no luck.

1 Answer

Relevance
  • Anonymous
    1 decade ago
    Favorite Answer

    you need to set a DirectoryIndex for each domain pointing to index.html and index.php if you want it to use both. Using the subdirectory you should always use the www.my.domain/subdir/

    as the forward slash is required for lower level directories.

Still have questions? Get your answers by asking now.