人々が .bak のようなファイルを apache ディレクトリから見ないようにすることは可能ですか? URL (http://foo.com/bar.bak) の要求がある場合は、404 エラーを発生させて、だれもがファイルをアップロードできないようにすることをお勧めします。
1 に答える
0
答えがわかったので、ここにあります。そのうちの 1 つは、httpd.conf で RewriteRule を使用することです。– Cedric 14 秒前 編集 答えがわかったので、ここにあります。そのうちの 1 つは、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 /
これが主なアイデアです。必要に応じて最初の正規表現を変更してください。(のような URLfoo?bar=obu
は機能しません。また、foo/bar
)
于 2011-02-09T09:46:47.970 に答える