简体   繁体   English

难以理解URL重写以代理到另一台服务器

[英]Trouble Understanding URL Rewrite to Proxy to Another Server

I am sorry if this is really simple and I am not paying attention. 很抱歉,这真的很简单,我没有注意。 I need to redirect a url query ( 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}). 我需要重定向网址查询( https://1.2.3.4:19999/abc/start?userid= {digit string}),以由另一台服务器处理( https://5.6.7.8/operate?service=checkuser&userid= {数字字符串})。 So far I've failed to do this correctly (this is my latest attempt): 到目前为止,我未能正确执行此操作(这是我的最新尝试):

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

Please can someone correct me? 请有人纠正我吗?

You really don't need the first condition because the rewrite rule takes care of that. 您实际上不需要第一个条件,因为重写规则可以解决这个问题。 You can try this rule here. 您可以在这里尝试此规则。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM