Troubleshooting apache redirects in production

Solution 1:

To log what's going on in the mod_rewrite module you need to set RewriteLog and RewriteLogLevel:

RewriteLog         /path/to/mod_rewrite.log
RewriteLogLevel    2

in your Apache config (you can't set them in your .htaccess).

Note that logging has changed in Apache 2.4.

Solution 2:

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:

LogLevel alert rewrite:trace6

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.