我想启用重写日志以调试一些使我有问题的重写规则。因此,我在 httpd.conf 文件的末尾添加了这些行:
<IfModule mod_rewrite.c>
RewriteLog "/logs/rewrite.log"
RewriteLogLevel 4
</IfModule>
我接下来要做的就是重新启动apache。但是,它会导致错误,并且不会启动。这就是我在XAMPP控制面板中得到的:
13:14:56 [Apache] Error: Apache shutdown unexpectedly.
13:14:56 [Apache] This may be due to a blocked port, missing dependencies,
13:14:56 [Apache] improper privileges, a crash, or a shutdown by another method.
13:14:56 [Apache] Check the "/xampp/apache/logs/error.log" file
13:14:56 [Apache] and the Windows Event Viewer for more clues
我在 error.log 中没有任何线索。实际上,发生此错误时没有生成线。
我还尝试更改rewritelog线以使用绝对路径:
RewriteLog "c:xamppapachelogsrewrite.log"
您能帮我吗?
apache的哪个版本?
在2.4中,重新写入*指令不再存在,因为已重写日志记录。在这种情况下,您应该将mod_rewrite.c:trace3
附加到LogLevel
行,其中TraceX是冗长的级别(8> = x> = 1)。输出将写入Apache标准错误日志(ErrorLog
)。
您还可以运行以下命令: httpd -t
(语法检查)然后httpd -w
(运行Apache但按住控制台,用作STDERR)