gpt4 book ai didi

php - .htaccess 不允许用户查看我的没有 index.php 的文件夹文件

转载 作者:可可西里 更新时间:2023-10-31 22:14:51 25 4
gpt4 key购买 nike

在我的服务器上,我创建了一个没有 index.php 或 index.html 的文件夹。

folder1/test.php
folder1/sample.php
folder1/hello.php

当我尝试访问该文件夹时,它会显示其中的所有文件。

这是我的顾虑,它不应该显示我文件夹中的文件,因为它很容易被黑客攻击。它应该显示一个类似于 403 Forbidden 的页面。我不想使用 index.php 只是将它们重定向到某个地方。

我听说这涉及到 .htaccess,这是明智之举。

请教我怎么做。

最佳答案

在文档根目录中的 .htaccess 文件中...

Options -Indexes

参见 http://httpd.apache.org/docs/2.2/mod/core.html#options

关于php - .htaccess 不允许用户查看我的没有 index.php 的文件夹文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7845315/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com