The Apache documentation states that RewriteRule and the should be put in the server configuration, but they can be put in htaccess because of shared hosting situations. I am in such a situation.
I am trying to set up a transparent proxy:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/foo [OR]
RewriteCond %{REQUEST_URI} ^/bar
RewriteRule ^(.*)$ http://example.com/$1 [P]
This is working fine...except for redirects (like if /foo
redirects to /bar
). Redirects go back to example.com, not my server.
I understand the the ProxyPassReverse
directive will solve this, but I get an "Internal Server Error" page when I add this to .htaccess
Unlike the Rewrite directives, ProxyPassReverse
will not work in htaccess.
How do I set up a transparent proxy in shared hosting situation, or is this not possible?
(This seems reasonable, since Rewrite already gets 80% of the way there, and having a transparent proxy in one htaccess would not interfere with having it in another.)