如何prevent用户能够访问一个特定的目录 [英] how to prevent users having access to a particular directory

查看:99
本文介绍了如何prevent用户能够访问一个特定的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为包括我的数据库和其他一些重要的文件,使用户不能访问包含的信息。我想用一个的.htaccess 文件重定向开头的请求/包括以错误/ 403.html 。这是我的code,但它不工作。有什么问题?!

  RewriteEngine叙述在#打开重写引擎
重写规则^ /包括/([A-ZA-Z] +)/ $ /errors/403.html [NC,L]
 

解决方案

如果你的配置文件是PHP中,你可以放置在该目录为空的index.php或创建的.htaccess与选项-Indexes <从所有有/ code>或拒绝(以包括/)。

I have a directory named "includes" containing information about my database and some other important files that users should not access. I want to use an .htaccess file to redirect requests that begin with "/includes" to errors/403.html. This is my code but it does not work. What's the problem?!

RewriteEngine On    # Turn on the rewriting engine
RewriteRule    ^/includes/([a-zA-Z]+)/?$    /errors/403.html    [NC,L]

解决方案

If your config files are php, you can just place empty index.php in that directory or create .htaccess with Options -Indexes or Deny from All there (in includes/).

这篇关于如何prevent用户能够访问一个特定的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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