简体   繁体   中英

Apache DirectoryIndex not working for subfolder

I'm using an .htaccess file to set a few options for a folder but the DirectoryIndex rule doesn't seem to be working in a sub-folder. Here is my .htaccess file.

AuthUserFile /var/www/.htpasswd
AuthType Basic
AuthName "Folder"
Require user joe
DirectoryIndex index.htm index.html

I know it is loading the .htaccess file because it is asking for the password if I try to go directly to the sub-folder but it won't load the index.htm file that is in there, I have to manually type in index.htm. The root folder with the .htaccess file does automatically load the index.htm file. What am I missing? Thanks!

Turns out Passenger was causing the problem. The solution was to disable Passenger for that folder.

<Location /public>
    PassengerEnabled off
</Location>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM