@clavans – The error message is a mod_rewrite error message that is being caused by mod_security. I was unable to find any information on whether or not this is a mod_security bug or mod_security is intentionally blocking the valid Apache R=405 HTTP status response code. We will continue to research this issue/problem and may decide to create alternative htaccess code for this mod_security bug/intentional block or may eventually find mod_security information about this to see how to proceed/fix the mod_security bug/etc.
https://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html#Mod_Rewrite_Errors
RewriteRule: invalid HTTP response code %s for flag R
Stackoverflow topic from 2011:
https://stackoverflow.com/questions/5544919/redirect-all-files-with-php-extension
Mod_rewrite only accepts the values 301, and 302 (the default if not specified) for the R flag. If you wish to send to a 404, I’d recommend sending the request to a custom 404 page:
RewriteRule \.php$ /404.php [L],
where 404.php sets the Response Status to 404.
mod_security search for verification and/or mod-security help information/documentation:
Unable to find any information about this mod_security error on the mod_security website or the Owasp Wiki. Unable to find any mod_security information on how to allow/whitelist this in mod_security, if it can be allowed/whitelisted or any other information regarding this mod_security error message.
Apache Server Help Documentation:
Apache 2.2 was released in 2005 – 10 years ago.
https://en.wikipedia.org/wiki/Apache_HTTP_Server
Apache 2.2 R Flag HTTP response status code help info:
https://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_r
Any valid HTTP response status code may be specified, using the syntax [R=305], with a 302 status code being used by default if none is specified. The status code specified need not necessarily be a redirect (3xx) status code. However, if a status code is outside the redirect range (300-399) then the substitution string is dropped entirely, and rewriting is stopped as if the L were used.
Apache 2.4 R Flag HTTP response status code help info:
https://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_r
Any valid HTTP response status code may be specified, using the syntax [R=305], with a 302 status code being used by default if none is specified. The status code specified need not necessarily be a redirect (3xx) status code. However, if a status code is outside the redirect range (300-399) then the substitution string is dropped entirely, and rewriting is stopped as if the L were used.
Summary|Conclusion:
I am unable to find any information about this mod_security issue besides the fact that the 500 error is being caused by mod_security not allowing R=405. I do not know if that is a mod_security bug or if that is intentional. R=405 has been available since Apache 2.2 – 10 years ago.