[英]Set directory index to .html file in Apache2
我有一个安装了 Apache2 的 Debian 网络服务器,需要在一个目录中设置 DirectoryIndex to.html 文件(正是这个名称 -.html)。 但是当我尝试从浏览器打开页面时,它会发送 403 错误。 我已经更改了 apache2.conf (设置为 allow.ht 文件),我将 .htacess 文件放在目录中并在其中设置:
DirectoryIndex .html index.php index.html
AllowOverride All
Order Deny,Allow
Allow from all
但它仍然无法正常工作并显示 403 错误。 我做错了什么,我忘记做什么?
正确答案是:
<FilesMatch "^\.html">
Order deny,allow
</FilesMatch>
DirectoryIndex .html
听起来您在 apache 文件中某处有一条规则,该规则拒绝访问以.
. 这通常是一件好事,因为许多敏感文件以点开头(即:.htaccess、.svn、.git、.htpasswd 等)
您可能可以通过以下方式解决此问题:
<FilesMatch "^\.html">
Order allow,deny
Allow from all
</Files>
免责声明:这似乎是一个黑客。 我不知道您要做什么,但可能有一种更清洁、更不易出错的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.