Page 1 of 1

Invalid command 'RewriteLog'

PostPosted: 11. August 2012 23:46
by Mazo
Hi, can anybody help me work out why I'm getting the following error when running httpd.exe -t from the command line?

Code: Select all
Invalid command 'RewriteLog', perhaps misspelled or defined by a module not included in the server configuration

This is happening after adding the following to httpd.conf

Code: Select all
<IfModule mod_rewrite.c>
    RewriteLog logs/rewrite.log

mod_rewrite is definitely on as I have rewrites working perfectly, and mod_rewrite is not commented in httpd.conf
Code: Select all
LoadModule rewrite_module modules/

Re: Invalid command 'RewriteLog'

PostPosted: 12. August 2012 11:44
by JonB
Try it this way:

Code: Select all
<IfModule rewrite_module>
    RewriteLog logs/rewrite.log

Good Luck

Re: Invalid command 'RewriteLog'

PostPosted: 13. August 2012 12:50
by JJ_Tagy
Interestingly enough, I tried this too and it doesn't like RewriteLog or RewriteLogLevel. Either way (mod_rewrite.c and rewrite_module) will work the same - they both pass the conditional check.

Re: Invalid command 'RewriteLog'

PostPosted: 13. August 2012 14:57
by JonB
Very strange -

Maybe its a Image

Edit - NOT BUGGY - it's a feature! :shock: ... write.html

Re: Invalid command 'RewriteLog'

PostPosted: 13. August 2012 15:27
by Altrea
JonB wrote:Edit - NOT BUGGY - it's a feature! :shock: ... write.html

Great! Every new day i learn new things :D

Re: Invalid command 'RewriteLog'

PostPosted: 14. September 2012 08:29
by sp00n
And in case anybody is wondering what's going on here (like I did), it seems that RewriteLog and RewriteLogLevel are not supported by Apache any more at all.
They're not deprecated like NameVirtualHost is currently, but instead completely unsupported and will prevent Apache from starting up. You're now supposed to use the 'LogLevel' directive with one of the 'trace1' to 'trace8' leves instead (I didn't see any rewrite entries with only 'debug').
An example would be 'LogLevel warn rewrite:trace8' if you want only warning messages for your modules, but all messages for your rewrite_mod.

There are two downsides of this changes:
a) There will be no error message whatsoever when you try to start Apache via the Control Panel. It will just immediately shut down again with a 'Return code: 0'. Also there will be no entry in the error log, no matter how high you set your LogLevel (in fact no error.log will be generated at all!).
Only if you start Apache from the command line, as seen in the original post or by using the apache_start.bat resp xampp_start.exe, you'll see the mentioned error message about an 'Invalid command'.

b) All your rewrite logs are now being added to your general (error) log file, which means you'll have to sort them out yourself. On Linux this may be relatively simply by using the tail -f error_log|fgrep '[rewrite:' command (see the documentation:, however on Windows it is not.

I'm still trying to find a way to automatically save the rewrite logs to their own file again.