简体   繁体   English

CakePHP .htaccess 中断对 apache 日志的访问

[英]CakePHP .htaccess breaking access to apache logs

I've read Cakes section on Apache but it doesn't cover my question.我已经阅读了 Apache 上的 Cakes 部分,但它没有涵盖我的问题。

Here's my .htaccess :这是我的.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule    ^$ /app/webroot/    [L]
    RewriteRule    (.*) /app/webroot/$1 [L]
</IfModule>

(I've had to add the leading / to make the paths absolute, to make it work on my live server, but I don't think that's causing my problem). (我必须添加前导/以使路径成为绝对路径,以使其在我的实时服务器上工作,但我认为这不会导致我的问题)。

I use a resellers account to host my site, and one of the features built in to the Control Panel is the ability to quickly read recent apache access logs.我使用经销商帐户来托管我的网站,控制面板内置的功能之一是能够快速读取最近的 apache 访问日志。 The CP installs a CGI script to dump the last ~100 lines from the logs in to the browser for convenience.为了方便起见,CP 安装了一个 CGI 脚本来将最后约 100 行的登录信息转储到浏览器中。

However, my .htaccess is rewriting all requests, and so the CGI script is failing to execute, and the logs aren't processed.但是,我的.htaccess正在重写所有请求,因此 CGI 脚本无法执行,并且未处理日志。 If I remove the .htaccess , I can execute the CGI and view logs as normal.如果我删除.htaccess ,我可以正常执行 CGI 并查看日志。

My host confirmed this was the cause, but would not elaborate any further due to it being 3rd party code etc.我的主人确认这是原因,但由于它是第 3 方代码等,因此不会进一步详细说明。

Are there any changes I can make to my .htaccess to allow the CGI scripts to execute I correctly, and provide access to my logs (which are stored above public_html ).我可以对我的.htaccess进行任何更改,以允许 CGI 脚本正确执行,并提供对我的日志(存储在public_html上方)的访问权限。

I have tried RewriteRule ^(.cgi) - [L] to ignore cgi files but it doesn't appear to work.我尝试过RewriteRule ^(.cgi) - [L]来忽略cgi文件,但它似乎不起作用。

Thanks for any insight.感谢您的任何见解。

If you want to ignore files with the extension "cgi" you would use:如果您想忽略扩展名为“cgi”的文件,您可以使用:

RewriteRule ^.*\.cgi$ - [L]

. is a wildcard in regular expressions.是正则表达式中的通配符。

Note: This rule has to appear before the "Everything" (.*) wildcard rule.注意:此规则必须出现在“Everything”(.*) 通配符规则之前。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM