如何使用查询字符串[重复]将URI重写到目标

时间:2022-12-31 10:36:25

This question already has an answer here:

这个问题在这里已有答案:

We are trying to redirect bin-ends2 to wines.jsp with a number of parameters passed over to the application server. Apache is stripping the parameters off and so the application server fdoes not know what yo put in the page. The Apache config is:

我们正在尝试将bin-ends2重定向到wines.jsp,并将许多参数传递给应用程序服务器。 Apache正在剥离参数,因此应用程序服务器不知道你在页面中放置了什么。 Apache配置是:

RewriteRule ^/wines/bin-ends2$ http://qa2:7025/wines/wines.jsp?Form=WinesSearch&type=binends [PT]

Does anyone know how to make this work?

有谁知道如何使这项工作?

1 个解决方案

#1


0  

You need to add QSA flag to your rule when you introduce new query string parameters and would like to preserve (better say, include) existing query string.

当您引入新的查询字符串参数并希望保留(更好地说,包括)现有查询字符串时,您需要将QSA标志添加到规则中。

Your rule should be

你的规则应该是

RewriteRule ^/wines/bin-ends2$ http://qa2:7025/wines/wines.jsp?Form=WinesSearch&type=binends [QSA,PT]

Useful link: http://httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa

有用的链接:http://httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa

#1


0  

You need to add QSA flag to your rule when you introduce new query string parameters and would like to preserve (better say, include) existing query string.

当您引入新的查询字符串参数并希望保留(更好地说,包括)现有查询字符串时,您需要将QSA标志添加到规则中。

Your rule should be

你的规则应该是

RewriteRule ^/wines/bin-ends2$ http://qa2:7025/wines/wines.jsp?Form=WinesSearch&type=binends [QSA,PT]

Useful link: http://httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa

有用的链接:http://httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa