Can't configure the rewrite log

允我心安 提交于 2019-12-21 03:23:13

问题


I'd like to enable the rewrite log to debug some rewrite rules that are giving me problems. So I added these lines at the end of my httpd.conf file:

<IfModule mod_rewrite.c>
   RewriteLog "/logs/rewrite.log"
   RewriteLogLevel 4
</IfModule>

Next thing I did was restart Apache. It causes an error however, and won't start. This is what I get in the XAMPP Control Panel:

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

I don't get any clue in error.log though. In fact no line is generated when this error occurs.

I also tried changing the RewriteLog line to use an absolute path:

RewriteLog "c:\xampp\apache\logs\rewrite.log"

Could you please help me?


回答1:


Which version of Apache?

In 2.4, RewriteLog* directives don't exist anymore as logging has been rewritten. In this case, you should append mod_rewrite.c:trace3 to your LogLevel line where traceX is the level of verbosity (8 >= X >= 1). The output will be written to Apache standard error log (ErrorLog).

Could you also run these commands: httpd -t (syntax checking) then httpd -w (run Apache but hold open the console, used as stderr)



来源:https://stackoverflow.com/questions/13937449/cant-configure-the-rewrite-log

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!