As my Apache configuration gets more and more complex and there are many moving parts, it can be tricky to debug problems. Right now, I have a setup where a certain virtual host setup generates a 301 for example.com
and a valid result for www.example.com
.
The 301 is to another virtual host that has nothing to do with example.com
, but I fail to figure out where this comes from.
Is there a way to tell Apache to show where and how it makes the decisions it makes? I am looking for something along the line of:
- Request for example.com: found in example.com.conf:23, processing .htaccess: rewriting to 301 www.othersite.com
Does this exist (or some other way of debugging the complexity of configfiles, .htaccess files and (PHP-) modules)?
AllowOverride None
and put all configuration directives in the main httpd.conf (and /or in VirtualHost and other snippets that get included in the main httpd.conf) rather than complicating the issue with.htaccess
files. Setting a CustomLog / LogFormat that includes a%v
allows you to narrow down the VirtualHost