繁体   English   中英

htaccess从301重定向中删除查询字符串

[英]Htaccess remove query string from 301 redirect

我写301重定向如下

Redirect 301 /catalogue/novelty_linen_q_t/spongebob_squarepants/spongebob_squarepants_quilt_cover_wonderland/image/?size=275x275&helper=1281395930.79 http://www.thebedroom.com.au/manchester/character-bedding.html?size=275x275&helper=1281395930.79

但是当我访问 http://www.thebedroom.com.au/catalogue/novelty_linen_q_t/spongebob_squarepants/spongebob_squarepants_quilt_cover_wonderland/image/?size=275x275&helper=1281395930.79

它重定向 http://www.thebedroom.com.au/manchester/character-bedding.html?size=275x275&helper=1281395930.79

........我需要重定向http://www.thebedroom.com.au/manchester/character-bedding.html

从您的Redirect指令中删除查询字符串,这就是您所拥有的:(确保始终滚动到右侧以查看注释)

#                                                                                                                           This question mark right here is why you have a query string in your redirect ---------v
Redirect 301 /catalogue/novelty_linen_q_t/spongebob_squarepants/spongebob_squarepants_quilt_cover_wonderland/image/?size=275x275&helper=1281395930.79 http://www.thebedroom.com.au/manchester/character-bedding.html?size=275x275&helper=1281395930.79

真的不知道为什么它的工作在所有,但你需要删除一切的? 离开了? 那里。 那确实有一个迷路的问号的难看的副作用,但是您可以使用mod_rewrite来消除它,将Redirect替换为:

RewriteEngine On
RewriteRule ^catalogue/novelty_linen_q_t/spongebob_squarepants/spongebob_squarepants_quilt_cover_wonderland/image/?$ /manchester/character-bedding.html? [L,R=301]

暂无
暂无

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

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