0
是否有可能阻止人们从apache目录中看到.bak之类的文件?如果存在对url的请求(http://foo.com/bar.bak),那么出现404错误并阻止任何人上传文件会很好。阻止从apache服务器上传* .bak * .inc文件
是否有可能阻止人们从apache目录中看到.bak之类的文件?如果存在对url的请求(http://foo.com/bar.bak),那么出现404错误并阻止任何人上传文件会很好。阻止从apache服务器上传* .bak * .inc文件
现在我知道了答案,这里是:其中之一是在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
)
我希望它能帮助某人:) – Cedric 2011-02-09 09:48:56