How do you troubleshoot Apache redirects in production? I know there's a logging feature somewhere that lets you log all the redirects that happen...
How do you troubleshoot Apache redirects in production? I know there's a logging feature somewhere that lets you log all the redirects that happen...
To log what's going on in the mod_rewrite module you need to set RewriteLog and RewriteLogLevel:
in your Apache config (you can't set them in your
.htaccess
).Note that logging has changed in Apache 2.4.
To get additional debugging information for debugging Apache issues (such as redirects), you can add RewriteLog and RewriteLogLevel to the configuration. The specifics of the configurations are different between Apache 2.2 and 2.4, so please check the version of Apache you are running.
Please check the logs, as they may tell you the specific details of what is causing the redirect. In general, Apache redirects can be troubleshot by adding the following to the Apache 2.4 configuration:
reference: http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#logging
I see that you have replaced the specifics of the Apache configuration for security. This is good, but I can't check the SSL for the domain due to this. There could also be an issue with Server Name Indication (SNI) which the browser is using for that domain name which does not match the Apache configuration.
It may be possible that DirectAdmin has added a configuration in addition to another configuration. Please check that you do not have multiple sections with the same IP address and port.
You may also want to confirm the domain matches the website's configuration. Depending on what CMS you are running (Magento, WordPress, Joomla!, etc.), it could be redirecting back to the original domain which Apache redirected from.
I generally create my own verbose CustomLog. In it, I include the HTTP Response header
Location
I also include other things such as the response time and HTTP Request header
X-Forwarded-For
, amongst a select other few things.