[英]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/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.