我做了所有必要的事情来防止目录浏览。
我的.htaccess
有以下代码:Options All –Indexes
当我浏览到存在子目录的目录时,它工作正常,例如"example.net/system"系统"具有"主"、"顶部"等子目录。但是当我进入"example.net/system/main"时,其中没有子目录,我可以看到所有php,html等文件。
我的 .htaccess 文件位于/var/www/html 文件夹中
好吧,我找到了一个没有 .htaccess 的解决方案。对于可能遇到相同问题的每个人:
sudo nano /etc/apache2/apache2.conf
然后向下滚动到:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Direcotry>
现在编辑Options Indexes FollowSymLinks
以Options FollowSymLinks
顺便说一句,AllowOverride None
舒尔德AllowOverride All
.
然后重新启动 apache/etc/init.d/apache2 restart