how to prevent users having access to a particular directory

主宰稳场 提交于 2020-01-07 05:01:09

问题


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]

回答1:


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/).



来源:https://stackoverflow.com/questions/19339070/how-to-prevent-users-having-access-to-a-particular-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!