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

查看:31
本文介绍了.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 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.

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

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