0

我试图通过将其重定向到一个空文件来阻止用户访问 munin 的主页

我相信这里的问题是 mod_rewrite:

    # HTML
RewriteCond %{REQUEST_URI} !^/static
RewriteCond %{REQUEST_URI} .html$ [or]
RewriteCond %{REQUEST_URI} =/
RewriteRule ^/(.*)          /opt/munin/www/cgi/munin-cgi-html/$1 [L]

我不确定如何防止根 index.html 指向 /opt/munin/www/cgi/munin-cgi-html/ 这是一个用于每个 index.html 页面的 perl 脚本。

4

1 回答 1

0

所以你想将每个文件夹的根目录重定向到 cgi 脚本,除了 web 根目录和static? 以及除根目录之外的每个 html 文件?

试试这个,没有任何 RewriteCond:

RewriteRule ^(?!static)([^./]+)/?$ /opt/munin/www/cgi/munin-cgi-html/$1 [L]
RewriteRule ^(?!static)[^./]+/([^.]+\.html)/?$ /opt/munin/www/cgi/munin-cgi-html/$1 [L]

这应该在您的DOCUMENT_ROOThtaccess 中。

于 2014-06-26T23:30:00.437 回答