无法理解 URL 重写代理到另一台服务器

Trouble Understanding URL Rewrite to Proxy to Another Server

如果这真的很简单而我没有注意,我很抱歉。我需要重定向 url 查询 (https://1.2.3.4:19999/abc/start?userid={digit string}) to be processed by another server (https://5.6.7.8/operate?service=checkuser&userid={digit string})。 到目前为止我没能正确地做到这一点(这是我最近的尝试):

    RewriteCond %{REQUEST_URI} ^/abc/ [NC]
    RewriteCond %{QUERY_STRING} ^/abc/start?
    RewriteRule ^/abc/(.*) https://5.6.7.8/operate?service=checkuser&userid= [P]

有人可以纠正我吗?

您真的不需要第一个条件,因为重写规则会解决这个问题。您可以在此处尝试此规则。

RewriteEngine On
RewriteCond %{QUERY_STRING} userid=(.*)
RewriteRule ^/?abc/start$ https://5.6.7.8/operate?service=checkuser&userid=%1 [P]