The P flag causes the resulting URL to be requested by proxy, using mod_proxy. This allows for complex proxying of content to a variety of back-end servers. You do need to have mod_proxy installed in order to use the [P] flag.

RewriteEngine On
RewriteRule ^(/(images|css).*)$ http://other.server.com:90$1 [P]
ProxyPassReverse / http://other.server.com:90/

The above ruleset causes all URLs, except those for the /images and /css directories, to be proxied through to another server, running on port 90. The ProxyPassReverse directive is to ensure that redirects returning from that server are correctly passed back to the client. (See the ProxyPassReverse documentation for more details.)

The more verbose [Proxy] syntax is also permitted.

_ Back to RewriteFlags_

  • No labels