mod_rewrite not working as internal proxy

2019-08-03 10:05发布

问题:

I have a site that needs to use mod_rewrite to direct traffic to www.example.com to 123.45.67.89, port 8080, through an internal proxy. This is the rewrite rule I'm using:

RewriteEngine On
RewriteRule ^(.*)$ http://123.45.67.89:8080/$1  [P]

When I visit www.example.com/myurl, I receive the following error with a 404:

The requested URL /myurl was not found on this server.

This redirect works on our dev server, but not on production. Is there an apache setting that I need to enable in order to make this work?

Thanks

回答1:

You need to have mod_proxy enabled to use the P flag.