重写远程站点上的URL

时间:2014-11-05 20:09:37

标签: php apache .htaccess mod-rewrite nginx

我管理了2个网站。 第一个网站“ foo.com ”是 Apache 2 的虚拟主机,重定向到另一个网站(' 1.2 .3.4:1234 '), Nginx

我使用了 Rewriterule Redirect ...但是浏览器中的网址始终转换为“ 1.2.3.4:1234

我能以某种方式保留原始网址(' foo.com ')吗?

非常感谢你。

注意: 我探讨了发布的解决方案:Redirect to other domain but keep typed domain

但是我收到了包含以下日志的503错误代码:

...
[Thu Nov 06 20:50:06 2014] [debug] mod_proxy_http.c(56): proxy: HTTP: canonicalising URL //1.2.3.4:1234/
[Thu Nov 06 20:50:06 2014] [debug] proxy_util.c(1540): [client 82.130.187.20] proxy: *: found reverse proxy worker for http://1.2.3.4:1234/
[Thu Nov 06 20:50:06 2014] [debug] mod_proxy.c(1020): Running scheme http handler (attempt 0)
[Thu Nov 06 20:50:06 2014] [debug] mod_proxy_http.c(1962): proxy: HTTP: serving URL http://1.2.3.4:1234/
[Thu Nov 06 20:50:06 2014] [debug] proxy_util.c(2026): proxy: HTTP: has acquired connection for (*)
[Thu Nov 06 20:50:06 2014] [debug] proxy_util.c(2082): proxy: connecting http://1.2.3.4:1234/ to 1.2.3.4:1234
[Thu Nov 06 20:50:06 2014] [debug] proxy_util.c(2209): proxy: connected / to 1.2.3.4:1234
[Thu Nov 06 20:50:06 2014] [debug] proxy_util.c(2460): proxy: HTTP: fam 2 socket created to connect to *
[Thu Nov 06 20:51:06 2014] [error] (70007)The timeout specified has expired: proxy: HTTP: attempt to connect to 1.2.3.4:1234 (*) failed
[Thu Nov 06 20:51:06 2014] [debug] proxy_util.c(2044): proxy: HTTP: has released connection for (*)
82.130.187.20 - - [06/Nov/2014:20:50:06 +0100] "GET / HTTP/1.1" 503 406
[Thu Nov 06 20:51:08 2014] [debug] mod_proxy_http.c(56): proxy: HTTP: canonicalising URL //1.2.3.4:1234/favicon.ico
[Thu Nov 06 20:51:08 2014] [debug] proxy_util.c(1540): [client 82.130.187.20] proxy: *: found reverse proxy worker for http://1.2.3.4:1234/favicon.ico, referer: http://foo.com/
[Thu Nov 06 20:51:08 2014] [debug] mod_proxy.c(1020): Running scheme http handler (attempt 0)
[Thu Nov 06 20:51:08 2014] [debug] mod_proxy_http.c(1962): proxy: HTTP: serving URL http://1.2.3.4:1234/favicon.ico
[Thu Nov 06 20:51:08 2014] [debug] proxy_util.c(2026): proxy: HTTP: has acquired connection for (*)
[Thu Nov 06 20:51:08 2014] [debug] proxy_util.c(2082): proxy: connecting http://1.2.3.4:1234/favicon.ico to 1.2.3.4:1234
[Thu Nov 06 20:51:08 2014] [debug] proxy_util.c(2209): proxy: connected /favicon.ico to 1.2.3.4:1234
[Thu Nov 06 20:51:08 2014] [debug] proxy_util.c(2460): proxy: HTTP: fam 2 socket created to connect to *
[Thu Nov 06 20:52:08 2014] [error] (70007)The timeout specified has expired: proxy: HTTP: attempt to connect to 1.2.3.4:1234 (*) failed
[Thu Nov 06 20:52:08 2014] [debug] proxy_util.c(2044): proxy: HTTP: has released connection for (*)
...