Problem: I need to know which Apache rewrite rules are being triggered, and possibly how.
Context: I’m trying to get a .xml request to rewrite to a .php script, all I’m getting is a useless message ([cgid:error] [pid 19515] (8)Exec format error: AH01241: exec of '/www/xml/v3/availability.xml' failed
). Apache version is 2.4.25.
What I have tried:
-
add
LogLevel alert mod_rewrite.c:trace8
to the top of/etc/apache2/apache2.conf
and thensudo systemctl restart apache2
– this achieved nothing, nothing extra shows up in the error log. -
I also tried putting it inside the
<Directory>
of the<VirtualHost *:443>
entry (sites-available & sites-enabled/test.conf
), this
also yielded no results (while it does haveAllowOverride All
). -
I also tried
LogLevel debug
-
I also tried
rewrite:trace8
instead ofmod_rewrite.c:trace8
2
Answers
The logs I were looking at were not the actual logs. There was a directive somewhere else setting the log location to another place. After finding the actual logs, I could see the debug information.
you can just put a hash symbol # in front of each rewrite rule which will prevent them from executing, then one by one remove the hash symbols # until you find which one is causing the error.