Enabling Rewrite Logs¶
The first step to debugging rewrite rules is to enable rewrite logging. Once rewrite logging has been enabled, you will be able to check the log to see which rewrite rule is not working and what is going wrong.
You can enable rewrite logging in your Apache configuration.
Locate the virtual host where the error is occurring.
Make sure you find the correct virtual host (i.e. 80, 443, or both if required). You won't see any rewrite log output if you set it to the wrong virtual host.
Open the relevent config file and add the
RewriteLogLevel directive followed by a number for how detailed you want your logs to be.
1 is least detailed.
9 is most detailed.
0 will turn off rewrite logging. For example:
Graceful restart LiteSpeed Web Server so the changes will take effect.
The Apache 2.4 rewrite log directive
LogLevel alert rewrite:trace3 is not yet supported by LiteSpeed, so please use
RewriteLogLevel 2 to enable rewrite logging for LiteSpeed even you run Apache 2.4.
More information on Apache rewrite log configuration can be found in the Apache mod_rewrite documentation.