.htaccess file not being read (“Options -Indexes” in .htaccess file not working)

后端 未结 8 1476
梦谈多话
梦谈多话 2020-12-13 12:56

I created an .htaccess file with only the following line:

Options -Indexes

However, the index is still shown for the directory.<

8条回答
  •  爱一瞬间的悲伤
    2020-12-13 13:36

    I had the same problem. I was using a virtual host so I modified httpd-vhosts.conf so if you are using one this could help

    Where you configure your host reference the directory tag to be the same as your document root

    
    ServerName somelocalserver
    DocumentRoot "C:/Websites/htdocs/yoursite"
    
        Options FollowSymLinks
        AllowOverride All
    
    

    I needed AllowOverride All to recognize the .htaccess file.

    Edit

    I also needed to add the path to the site root in the directory tag itself. i.e. . This was the default in the samples I used.

提交回复
热议问题