问题
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