0

我将这些行放入httpd.confApache 2.2 的文件中:

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

有什么建议吗?

4

1 回答 1

3

改变:

RewriteRule      /api/upload  /api/post

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

来自:RewriteRule 指令Apache 文档

在 Directory 和 htaccess 上下文中,模式最初将与文件系统路径匹配,在删除引导服务器到当前 RewriteRule 的前缀之后(例如“app1/index.html”或“index.html”,具体取决于指令的位置定义)。

/因此,在匹配时不要以RewriteRule.

于 2012-02-24T18:25:33.177 回答