HTAccess 将某些页面路由到其他域

HTAccess routing certain pages to other domain

您好,我想将某些页面重新路由到另一个域。我喜欢向 http://example.com/get.php?username=123&password=123&type=abc and route it to http://example2.com/get.php?username=123&password=123&type=abc 发送 post/get 请求。

我有 4 个页面我想重新路由到另一个域,我不想重新路由所有数据 - 因为在第一个域上我有一个网站 运行 和一个 api .所以我只想路由某些页面。

我可以重写我的 urls,就像我已经为 api 做的那样,让 url 有很好的 urls - 但我不知道如何让上面的工作。

我用这个工作了:

# Rewrite to other domain
RewriteRule ^player_api.* http://example2.com:25461%{REQUEST_URI}?%{QUERY_STRING} [R,QSA]
RewriteRule ^panel_api.* http://example2.com:25461%{REQUEST_URI}?%{QUERY_STRING} [R,QSA]
RewriteRule ^xmltv.* http://example2.com:25461%{REQUEST_URI}?%{QUERY_STRING} [R,QSA]
RewriteRule ^get.* http://example2.com:25461%{REQUEST_URI}?%{QUERY_STRING} [R,QSA]

这只是找到了 302,但它确实有效。现在我使用一个较短的域——和我自己的域来转发请求。