2013-03-14 70 views
1

我需要使用以下重寫規則與PROXYPASS和proxyPassReverse阿帕奇重寫規則與PROXYPASS和proxyPassReverse

RewriteEngine On 
RewriteRule ^(market|stock|mutual)$ stackoverflow/$1 [L] 

我的虛擬主機認定中是

<VirtualHost *> 
    ServerName localhost 
    ProxyPass/http://localhost:8080/ 
    ProxyPassReverse/http://localhost:8080/ 
</VirtualHost> 

我應該在哪裏插入重寫規則,使當我點擊URL - localhost/market時,它會執行一個內部重寫到localhost:8080/stackoverflow/market

請幫忙

回答

2

得到它

<VirtualHost *> 
    ServerName localhost 
    ProxyPass/http://localhost:8080/stackoverflow/ 
    ProxyPassReverse/http://localhost:8080/stackoverflow/ 
    RewriteEngine On 
    RewriteRule ^(market|stock|mutual)$ stackoverflow/$1 [L] 
</VirtualHost> 
+0

你能幫助我理解了爲什麼在''部分在這種情況下放置一個'RewriteRule'有沒有影響?是否因爲'ProxyPass'首先生效,其他指令不適用? – iX3 2013-12-11 15:37:49

+0

iX3,你是對的。 ProxyPass在mod_rewrite和mod_alias之前優先。 – rekamso 2014-03-04 19:35:54