Give no one access in a directory .htaccess

帅比萌擦擦* 提交于 2019-12-23 13:09:24

问题


It is probably very simple but I can't find it. I want to make a .htaccess file so no one can get into the folder. except for the php on the server.

does anyone know the code line?

Thanks Matthy


回答1:


You want

Deny from all



回答2:


Instead of denying all traffic you could try redirecting it with mod_rewrite to make it useful i.e. back into the flow of the site.

RewriteEngine on
rewriteRule ^path/to/forbidden/directory/? index.php [L]



回答3:


Maybe it's better to change the rights and ownerships of the folder instead of using .htaccess to do it.

Deny from All

is the way to do it in .htaccess




回答4:


<Files *.*>
order allow,deny
deny from all
</Files>


来源:https://stackoverflow.com/questions/1218964/give-no-one-access-in-a-directory-htaccess

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