是否可以阻止人们从amache目录中看到.bak等文件?如果有网址请求(http://foo.com/bar.bak),最好有404错误,并阻止任何人上传文件。
答案 0 :(得分:0)
现在我知道了答案,这里是:其中一个是在httpd.conf中使用RewriteRule。 - 塞德里克14秒前编辑 现在我知道了答案,这里是:其中一个是在httpd.conf中使用RewriteRule。
RewriteEngine On # Turn on the rewriting engine RewriteRule
RewriteRule ^(.*(\.(html|htm|gif|js|jpg|jpeg|php|css)|\/))$ $1 [L,NC]
# do not do anything (no rewriting), but don't execute the next rule
#("NC", tells Apache that this rule should be case-insensitive, and "L" tells Apache not to process any more rules if this one is used.)
RewriteRule ^.*$ / [NC,R] # rewrite all the other urls to /
这是主要的想法。请根据您的需要修改第一个正则表达式! (因为foo?bar=obu
等网址不起作用,也不会foo/bar
)