2013-11-26 59 views
1

在我的Apache服務器,我有2個獨立的虛擬主機:foo.example.com & bar.example.comApache mod_proxy或or passthrough?

我需要傳遞請求foo.example.com/bar/uri要傳遞給bar.example.com/uri透明地給用戶(爲了SSL的緣故)。它位於同一個apache實例上,但正如我所說,在不同的虛擬主機下。

我試過RewriteRule與[PT]的各種組合,但我不斷收到無效的URI。定期重寫本身不起作用,因爲它需要通過URL引擎返回來由其他虛擬主機提取。

我試過(foo中很明顯)的一個例子:

RewriteRule ^/bar/([^/\.]+)/?$ http://bar.example.com/$1 [PT] 

這是正確的做法還是應該使用的ProxyPass(反向)回自己?

回答

1

你可以試試這個規則:

RewriteRule ^/?bar/([^/.]+)/?$ http://bar.example.com/$1 [L,P]