2017-02-19 126 views
1

我会尽量解释你是我想要做的服务内容:mod_rewrite的代理相反,从其他网站

我有我的地方网站http://localhost/(WAMP SERVER) 我有另外一个网站http://domain.com/

我会喜欢设置一个mod_rewrite规则,可能使用proxyreverse,这样所有对localhost的请求都将被设置为domain.com,并在不使用任何301重定向的情况下从localhost返回。

对于为例: http://localhost/应该呈现的http://domain.com/ http://localhost/index.php?id=1内容应呈现的http://domain.com/index.php?id=1

的内容,我想如果可能的话也通过所有的头,GET和POST。

我已经试过,但没有成功,并在谷歌无法找到任何东西:

ProxyPass/http://localhost/domain/ ProxyPassReverse/http://domain.com/

我也曾尝试教程从这个链接,但它确实我重定向到domain.com和s不是我想要的http://httpd.apache.org/docs/current/rewrite/proxy.html

PS:mod_rewrite,mod_proxy和mod_proxy_http被激活。

谢谢

回答

1

可以使用P模重写的(代理)标志:

RewriteEngine on 

RewriteRule^http://example.com%{REQUEST_URI} [P] 

这会在内部向前从您的域example.com中的所有请求。

+0

谢谢!那工作 – user3119384