Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache htaccess目录浏览仅在存在subdir时工作_Apache_.htaccess - Fatal编程技术网

Apache htaccess目录浏览仅在存在subdir时工作

Apache htaccess目录浏览仅在存在subdir时工作,apache,.htaccess,Apache,.htaccess,为了防止目录浏览,我做了一切必要的事情 My.htaccess有以下代码:选项所有–索引 当我浏览到一个有子目录的目录时,它可以正常工作,例如“example.net/system”“system”有像“main”、“top”等子目录。但是当我进入“example.net/system/main”时,没有子目录,我可以看到所有的php、html等文件 我的.htaccess文件位于/var/www/html文件夹中好吧,我找到了一个没有.htaccess的解决方案。对于每个可能有相同问题的人:

为了防止目录浏览,我做了一切必要的事情

My
.htaccess
有以下代码:
选项所有–索引
当我浏览到一个有子目录的目录时,它可以正常工作,例如“example.net/system”“system”有像“main”、“top”等子目录。但是当我进入“example.net/system/main”时,没有子目录,我可以看到所有的php、html等文件


我的.htaccess文件位于/var/www/html文件夹中

好吧,我找到了一个没有.htaccess的解决方案。对于每个可能有相同问题的人:

sudo nano/etc/apache2/apache2.conf

然后向下滚动至:


选项索引跟随符号链接
不允许超限
要求所有授权
现在编辑Ymlinks之后的
选项索引
选项之后的Ymlinks

顺便说一句,
AllowOverride None
应该是
AllowOverride All

然后重新启动apache
/etc/init.d/apache2 restart