I have an Apache configuration where I need to apply both URL redirection and ProxyPass directives. However, I want to ensure that the redirection rules are checked first before proxying the request.
I currently have the following configuration:
<IfModule mod_proxy.c>
ProxyPreserveHost off
SSLProxyEngine on
SSLProxyVerify off
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
ProxyPass /shop https://example.com/shop
ProxyPassReverse /shop https://example.com/shop
</IfModule>
My redirects are still in a .htaccess
file, but I guess if needed I can move them to the same configuration file where the proxy rules are.
Redirect 301 "/shop/xxxx/xxxx/xxx/xxxx" "/shop/xxxx/xxxx"
the ProxyPass directives are being processed before the redirection rules. As a result, the requests matching the redirection pattern are not being redirected and are instead proxied.
I would like to ensure that the redirection rules are checked first, and if a match is found, a redirection should be performed. Only if there is no matching redirection, the request should be proxied using the ProxyPass directives.
Is there a way to achieve this combination of redirection and ProxyPass directives in the desired order? Any guidance or alternative solutions would be greatly appreciated. Thank you!