2012-01-12 123 views
0

我有一個動態的URL domain.com/product/Paper_Bags/Merchandise_Bags_-_Matte_Colors/6_25__X_9_25_/Misty_Grey?7。其中,當所謂的需要重定向到domain.com/paper-merchandise-bags-plain-white/htaccess的重定向需要幫助

我使用的條件和規則爲

RewriteCond %{QUERY_STRING} (.*)$ 
RewriteRule ^(.*)/Misty_Grey http://domain.com/paper-merchandise-bags-plain-white/? [R=301,L] 

但它不工作。有人可以幫助我解決這個問題。

如果我使用RedirectMatch ^(.*)/Misty_Grey http://domain.com/paper-merchandise-bags-plain-white/ 它被重定向到http://domain.com/paper-merchandise-bags-plain-white/?7 有什麼辦法去除?7,塔的查詢字符串將不可見

回答

0

試試下面的命令,

//Rewrite to www 
Options +FollowSymLinks 
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^domain.com[nc] 
RewriteRule ^(.*)$ http://www.domain.com/$1 [r=301,nc] 

//301 Redirect Old File 
Redirect 301 http://domain.com/product/Paper_Bags/Merchandise_Bags_-_Matte_Colors/6_25__X_9_25_/Misty_Grey?7 http://domain.com/paper-merchandise-bags-plain-white/? 
+0

對不起它不是加工。 – joseph 2012-01-12 06:57:15