2012-02-23 104 views
0

規則我把這個線爲httpd.conf文件的Apache 2.2:阿帕奇的ProxyPass測繪工作,重寫它不工作

ProxyPass  /api/post http://localhost:8082/DE_API/post 
ProxyPassReverse /api/post http://localhost:8082/DE_API/post 
RewriteRule  /api/upload /api/post 

那麼下面的請求是正確的映射:

http://mydomain.com/api/post 

這等不不工作:

http://mydomain.com/api/upload 

有什麼建議嗎?

回答

3

變化:

RewriteRule  /api/upload /api/post 

RewriteRule  ^api/upload /api/post [L,NC] 

來源:RewriteRule Directive Apache docs

在目錄和htaccess的背景下,模式將首先對文件系統路徑匹配,取出後將服務器引導至當前RewriteRule的前綴(例如「app1/index.html」或「index.html」) g指定指令的位置)。

因此,在RewriteRule中匹配時,請勿使用/開始模式。

+0

非常感謝! – 2012-02-25 08:45:08