Hello, I'm using Apache on Windows with the XAMPP bundle, and I'm having a problem nobody seems to know why (I didn't get any answer in the official XAMPP forum).
What I need is to enable the rewrite log in order to debug some rewrite rules that are not working as expected. So this is what I did at the end of my httpd.conf file, making sure the module is being loaded:
<IfModule mod_rewrite.c> RewriteEngine On RewriteLog "/logs/rewrite.log" RewriteLogLevel 4 </IfModule>
I was said to use <IfModule rewrite_module> instead because the other one was incorrect, and I even tried without the IfModule tags. When I restart Apache with these directives, it doesn't start and I get this error message 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 when looking in error.log. In fact no error line is generated when this occurs. I also tried removing RewriteEngine On, with an absolute path:
Seems like my Apache configuration doesn't admit this directive. Your help would be really appreciated.
Apache 2.4 doesn't use the RewriteLog directive anymore. Instead, you must append this command mod_rewrite.c:traceX to the LogLevel line, where X represents the verbosity level from 0 to 8. Then if you have, like in my default case, LogLevel warn, and I want a level 4, you should do this in httpd.conf:
LogLevel warn mod_rewrite.c:trace4
Rewrites will be logged in the error.log or wherever you defined the errors log. This is a little inconvenience because as far as I know, it's not possible to use another log.
I hope this helps anyone else who bumps into the same problem.