Mod_rewrite网址无效

时间:2018-05-07 12:24:12

标签: mod-rewrite apache2.4

我有一个网址

**12.2.2.2:8073/abc=200&&Yr=18&Hr=12&Mi=45&Sec=32**

我想要的是

**10.1.250.153:6180/testapp/rest/?abc=200&&Yr=18&Hr=12&Mi=45&Sec=32**

所以对于这个

 RewriteEngine On

    LogLevel debug rewrite:trace6

    ForensicLog "C:\Apache24\logs\forensic.log"

    RewriteRule "^/(.+)$" "http://10.1.250.153:6180/testapp/rest/?$1"  [NC,L,P]
    ProxyPassReverse "/" "http://10.1.250.153:6180/testapp/rest"

但它不起作用,在ForensicLog中,网址是

+4348:5af043cc:0 | GET / abc = 200&& Yr = 18& Hr = 12& Mi = 45& Sec = 32 HTTP / 1.1 |主机:12.2.2.2:2222%3a8073 |连接:保持-alive |升级 - 不安全请求:1 |用户代理:Mozilla / 5.0(Windows NT 6.3; Win64; x64)AppleWebKit / 537.36(KHTML,如Gecko)Chrome / 66.0.3359.139 Safari / 537.36 |接受:text / html ,application / xhtml + xml,application / xml; q = 0.9,image / webp,image / apng, / ; q = 0.8 | Accept-Encoding:gzip,deflate | Accept-Language:en-美国,恩; q = 0.9 -4348:5af043cc:0

知道我在这里做错了什么吗?

1 个答案:

答案 0 :(得分:1)

尝试使用原始请求:

RewriteCond %{THE_REQUEST} ^\S+\s+/(\S*)
RewriteRule "^" "http://10.1.250.153:6180/testapp/rest/?%1" [P]