.htaccess rewriting with the [P] proxy flag
I am trying to do an invisible (transparent ?) rewrite via .htaccess and the proxy flag. It works with the [R] flag but not with the [P] flag because it just gives a 500 error. The two domains are on separate servers and the mod_proxy module is ena开发者_Python百科bled. Is my .htaccess correct?
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} =one.com
RewriteRule ^(.*)$ http://two.com/$1 [P]
If mod_proxy
was compiled as a shared module, it requires that you explicitly load the relevant submodules too. It's possible that on your server mod_proxy_http
is not enabled, which leads to an internal server error when mod_proxy
tries to handle the request passed to it by mod_rewrite
.
mod_proxy
itself is enabled and probably working like you said, since if you don't have it enabled, use of the P
flag will just generate a 404 response. It's hard to know for sure though without the error log, so you may need to find someone with access to it to see what's going on to help you resolve the problem.
精彩评论