mod_rewrite -> 重写规则替换原始 URL 中的应用程序上下文部分

mod_rewrite -> 重写规则替换原始 URL 中的应用程序上下文部分

我有要求用户像在浏览器中一样输入 url http://example.com/Welcome,但我需要将其发送到http://myip.com/someapp/next.html,所以我在 httpd.conf 文件中写了虚拟主机:

<VirtualHost *:80>
     ProxyRequests off
     ProxyPreserveHost On
     RewriteEngine On

     RewriteRule "^/(.*)" "http://myip.com/someapp/next.html" [P]
     ProxyPassReverse "/" "http://myip.com/someapp/next.html"

</VirtualHost>

这部分工作正常。当用户输入 url 时,http://example.com/Welcome它将被替换为http://example.com。我怎样才能保留完整的 url ( http://example.com/Welcome)?非常感谢任何帮助。

编辑: 以下是此次调用的 access_log

184.180.123.46 - - [06/Dec/2017:21:10:41 +0000] "GET /myip.com/images/logo.png HTTP/1.1" 200 6697 "http://example.com/Welcome" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"
184.180.123.46 - - [06/Dec/2017:21:10:51 +0000] "POST /myip/somepage HTTP/1.1" 200 7 "http://example.com/Welcome" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"
184.180.123.46 - - [06/Dec/2017:21:10:52 +0000] "GET / HTTP/1.1" 200 3391 "http://example.com/Welcome" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"
184.180.123.46 - - [06/Dec/2017:21:11:01 +0000] "GET / HTTP/1.1" 200 3391 "http://example.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"

相关内容