Forward requests over Apache with ProxyPass

For various reasons you may want to display information from one server to another. I won’t go into the reasons.

I will give an example of how this can be implemented using the mod_rewrite and mod_proxy tools of the Apache2 web server. In this example, I will be proxying WordPress admin requests from one server to another.

Using mod_proxy:

Proxy Requests On
ProxyPass /wp-admin
ProxyPass /wp-login.php
ProxyPassReverse /wp-admin

If you want to proxy SSL/https traffic then add:

SSLProxyEngine on

Using mod_rewrite:

Rewrite Engine on
RewriteCond %{REQUEST_URI} ^/wp-admin [NC]
RewriteCond %{REQUEST_URI} ^/wp-login.php [NC]
RewriteRule ^(.*)${REQUEST_URI} [P]

In either case, mod_rewrite, mod_proxy and mod_proxy_http must be enabled.

a2enmod mod_rewrite mod_proxy mod_proxy_http