Invalid command 'RewriteLog'

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Invalid command 'RewriteLog'

Postby Mazo » 11. August 2012 23:46

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
</IfModule>


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/mod_rewrite.so
Mazo
 
Posts: 1
Joined: 11. August 2012 23:43
Operating System: Windows 7

Re: Invalid command 'RewriteLog'

Postby JonB » 12. August 2012 11:44

Try it this way:

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


Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Invalid command 'RewriteLog'

Postby JJ_Tagy » 13. August 2012 12:50

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.
JJ_Tagy
 
Posts: 788
Joined: 30. January 2012 13:44
XAMPP version: 5.5.15
Operating System: Windows 10 Pro x64

Re: Invalid command 'RewriteLog'

Postby JonB » 13. August 2012 14:57

Very strange -

Maybe its a Image

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

http://httpd.apache.org/docs/current/mo ... write.html
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Invalid command 'RewriteLog'

Postby Altrea » 13. August 2012 15:27

JonB wrote:Edit - NOT BUGGY - it's a feature! :shock:

http://httpd.apache.org/docs/current/mo ... write.html

Great! Every new day i learn new things :D
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Invalid command 'RewriteLog'

Postby sp00n » 14. September 2012 08:29

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: http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#logging), 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.
sp00n
 
Posts: 7
Joined: 10. May 2007 09:20


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 84 guests