Search code examples
apacheproxypass

How can I configure ProxyPass in the case of both directory path only and with file path


What I want is a redirect configuration like the following.

https://example.com/abc => https://test.com
https://example.com/abc/test.html => https://test.com/abc/test.html

I am trying to do that but not working yet.

ProxyPassMatch ^/abc/$ https://test.com
ProxyPass /abc https://test.com/abc

Any help will be appreciated.


Solution

  • For starters, you most likely need (notice the slashes):

    ProxyPassMatch ^/abc$ https://test.com
    ProxyPass /abc/ https://test.com/abc/
    

    To cover the use case you're explaining.