Apache – Proxy some URLs to another server

In Apache, if you want to forward some requests matching a regex to another server, you can use the rule ProxyPassMatch.

Here is an example that is matching URL like:

  • /admin/anything
  • /list/any number/info
  • /manage/any number

and redirect it to https://my-hidden-domain.com:26000

ProxyPreserveHost On
ProxyRequests Off
ProxyPassMatch ^/(admin/.*@.*|list/[0-9]*/info|manage/[0-9]*)$ https://my-hidden-domain.com:26000/$1

You can then define any rule you want with multiple rules matching different regex.ègles que vous voulez avec différentes expressions régulières.