简体   繁体   English

301使用查询字符串重定向URL,删除部分起始URL,将完整查询保留在末尾

[英]301 redirect URL with query string, removing part of the beginning URL, keeping the full query at the end

I'm trying to find a redirect that will remove part of a URL (in the middle), but leaves the query string in place at the end. 我正在尝试找到一个重定向,该重定向将删除一部分URL(在中间),但将查询字符串保留在末尾。

I can do this fine via a single url redirect, but there are hundreds of these urls so I'm trying to find a rule that might be able to do for all of them in one fell swoop, so i don't have to make one for each and any new ones will get redirected automatically. 我可以通过单个URL重定向来完成此操作,但是其中有数百个URL,因此我试图找到一条规则,可以一次完成所有规则,所以我不必每个新的都会自动重定向。

I'm trying to remove 'search.php' from the urls, here is an example: 我正在尝试从网址中删除“ search.php”,这是一个示例:

www.site.com/products/search.php?rPage=/items/listing/detail_handler.jsp?code=219592&units=Feet&item_id=2624472 www.site.com/products/search.php?rPage=/items/listing/detail_handler.jsp?code=219592&units=Feet&item_id=2624472

to redirect to: www.site.com/products/?rPage=/items/listing/detail_handler.jsp?code=219592&units=Feet&item_id=2624472 重定向到:www.site.com/products/?rPage=/items/listing/detail_handler.jsp?code=219592&units=Feet&item_id=2624472

Thanks for your time. 谢谢你的时间。

根据文档 ,查询字符串默认情况下不更改地传递

RewriteRule products/search.php http://www.site.com/products/ [L,R=301]

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

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