htaccess的不允许用户查看我的文件夹的文件不具有的index.php [英] .htaccess don't allow user to view my folder files that don't have index.php

查看:209
本文介绍了htaccess的不允许用户查看我的文件夹的文件不具有的index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的服务器,我已经创建了一个不具有的index.php或index.html文件夹。

On my server, I've created a folder that doesn't have an index.php or index.html.

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

当我试图访问该文件夹,它显示了在那里的所有文件。

When I tried to visit that folder, it shows all the files in there.

这是我关心的,它不应该显示的文件在我的文件夹,因为很容易出现的黑客攻击。它应该显示一个网页像403禁止。我不想使用的index.php文件只是他们重定向到某个地方。

That is my concern, it should not show the files in my folder because it is prone to hacking. It should display a page like a 403 Forbidden. I don't want to used an index.php just to redirect them to somewhere.

我听说,这涉及到的.htaccess,这是一个聪明的做法。

I heard that this involves .htaccess and this is a smart thing to do.

请教我该怎么做。

推荐答案

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

In a .htaccess file in your document root...

Options -Indexes

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

这篇关于htaccess的不允许用户查看我的文件夹的文件不具有的index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆