[英]301 Redirect with QUERY STRING
我想重定向
http://www.mydomain.com/ladies-boots/?shoesize=43&calfwidth=K
至
http://www.mydomain.com/ladies-boots/#nogo&landing_sef_url=&producttype=
ladies-boots&shoesize=43&calfwidth=K
目前,我正在使用以下代碼,但是無法正常工作。
RewriteCond %{QUERY_STRING} ^ladies-boots/?shoesize=([0-9]+)\&calfwidth=([A-Z])$
RewriteRule ^.*$ http://www.mydomain.com/ladies-boots/#nogo&landing_sef_url=&producttype=ladies-boots&%1 [R=301,L]
請幫我解決這個問題。
這是我更新的最新代碼,
RewriteCond %{QUERY_STRING} ^shoesize=([0-9]+)\&calfwidth=([A-Z])$
RewriteRule ^ladies-boots/$ http://www.mydomain.com/ladies-boots/#nogo&landing_sef_url=&producttype=ladies-boots&shoesize=%1&calfwidth=%2? [R=301,L]
QUERY_STRING參數就是這樣; 它不包含URI路徑信息。
RewriteCond %{QUERY_STRING} ^shoesize=([0-9]+)\&calfwidth=([A-Z])$
RewriteRule ^ladies-boots/$ $0#nogo&landing_sef_url=&producttype=ladies-boots&%1 [R=301,NE,L]
請記住要打開引擎( RewriteEngine On
)並首先設置一個基礎( RewriteBase /
)。 $ 0拾取整個匹配字符串,並且服務器和協議默認為相同,因此無需指定。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.