views:

509

answers:

2

I need to offer a directory listing of the root directory of my site, so I created an .htaccess file containing

options +indexes

It works for subdirectories, but for the main directory I get the Test Page for the Apache HTTP Server on Red Hat Enterprise Linux page.

I have two sites that are identical except for the PHP version installed. On one site (PHP 5.2.1) this technique works fine. On the other (PHP 5.2.9), it doesn't.

As far as I know, the Apache installations are identical, and I verified that the httpd.conf files are identical.

On both sites, the htaccess works for subdirectories. My problem is with the main site directory.

My goal is to create simple sites based on directory listings, similar to znvy.com.

Is there something about the updated PHP version that prevents listing a root directory? If so is there a workaround?

[update] I looked at the page using rex swain's http viewer and the server of the problem site is returning a 403 status with the Apache default page.

A: 

Does your main directory have an index.html or index.php file? I believe +Indexes only shows if a default document doesn't exist in the directory.

pygorex1
No, I renamed the default pages to eliminate that possibility. And, if that were the problem, I would see my page instead of a default Apache page.
Andrew Swift
+1  A: 

The problem was being caused by the /etc/httpd/conf.d/welcome.conf file:


    Options -Indexes
    ErrorDocument 403 /error/noindex.html

That file overrides the htaccess and turns indexing off for any root web directory. Renaming it to welcome.con and restarting the server solved the problem.

Andrew Swift