通过htaccess拒绝直接访问文件夹和文件情况如下:有一个index.php根文件夹中的文件中包含了一些文件。index.php在includes文件夹。1份其他档案(submit.php)位于表单提交操作的根文件夹中。我希望限制用户直接访问includes按htaccess文件夹。也是为了submit.php..但包括将为index.php档案。比如,如果用户输入www.domain.com/includes/somepage.php,它将限制它(可能会重定向到错误页面)。
3 回答

慕斯709654
TA贡献1840条经验 获得超5个赞
includes
includes
.htaccess
deny from all

蝴蝶不菲
TA贡献1810条经验 获得超4个赞
mod_rewrite
RewriteRule ^(includes/|submit\.php) - [F,L,NC]
/includes/
/submit.php

青春有我
TA贡献1784条经验 获得超8个赞
<Files ~ "^.*"> Deny from all</Files><Files ~ "^index\.php|css|js|.*\.png|.*\.jpg|.*\.gif"> Allow from all</Files>
- 3 回答
- 0 关注
- 1394 浏览
添加回答
举报
0/150
提交
取消