I am using RewriteRule
in my .htaccess
file to modify an incoming URL. It works fine except I want the rule to act as a proxy, rather than a redirect. But if I append the [P]
proxy flag to the rule then the rule triggers a 500 error. The Apache logs show a 500 log when the rewrite rule includes the "P" flag and a normal 302 log for the same URL when the rule does not include the "P" flag. Note that the result is the same for any valid URL pattern and URL substitution specified in the rewrite rule.
I enabled mod_proxy
and mod_proxy_http
by entering sudo a2enmod proxy
and sudo a2enmod proxy_http
followed by sudo systemctl restart apache2
but I'm still getting the 500 error. When I enter apachectl -M
the following two lines appear in the list:
proxy_module (shared)
proxy_http_module (shared)
Does anyone know what else is needed to get RewriteRule's proxy flag to work?