.htaccess用[P]代理标志重写 [英] .htaccess rewriting with the [P] proxy flag

查看:146
本文介绍了.htaccess用[P]代理标志重写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过.htaccess和代理标志进行不可见的(透明的?)重写.它可以与[R]标志一起使用,但不能与[P]标志一起使用,因为它只给出500错误.这两个域位于单独的服务器上,并且启用了mod_proxy模块.我的.htaccess是否正确?

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 enabled. Is my .htaccess correct?

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST}    =one.com
RewriteRule ^(.*)$          http://two.com/$1 [P]

推荐答案

如果mod_proxy被编译为共享模块,则还需要您显式加载相关子模块.可能在您的服务器上未启用mod_proxy_http,当mod_proxy尝试处理mod_rewrite传递给它的请求时,这会导致服务器内部错误.

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本身已按照您的说明启用,并且可能会正常工作,因为如果您未启用它,则使用P标志只会生成404响应.即使没有错误日志,也很难确定,因此您需要寻找有权访问它的人,以查看发生了什么情况来帮助您解决问题.

mod_proxy itself is enabled like you said and likely working, 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 made need to find someone with access to it to see what's going on to help you resolve the problem.

这篇关于.htaccess用[P]代理标志重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆