Apache repwriterule与proxyPass和proxyPassReverse

时间:2013-03-14 07:15:54

标签: apache mod-rewrite rewrite httpd.conf proxypass

我需要在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

请帮忙

1 个答案:

答案 0 :(得分:2)

搞定了

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