.htaccess 需要htaccess重定向帮助

.htaccess 需要htaccess重定向帮助,.htaccess,redirect,.htaccess,Redirect,我有一个动态urldomain.com/product/Paper\u Bags/products\u Bags\u-\u Matte\u Colors/6\u 25\u X\u 9\u 25\u/Misty\u Grey?7。调用时需要重定向到domain.com/paper-products-bags-plain-white/ 我使用的是条件和规则 RewriteCond %{QUERY_STRING} (.*)$ RewriteRule ^(.*)/Misty_Grey http://do

我有一个动态url
domain.com/product/Paper\u Bags/products\u Bags\u-\u Matte\u Colors/6\u 25\u X\u 9\u 25\u/Misty\u Grey?7
。调用时需要重定向到
domain.com/paper-products-bags-plain-white/

我使用的是条件和规则

RewriteCond %{QUERY_STRING} (.*)$
RewriteRule ^(.*)/Misty_Grey http://domain.com/paper-merchandise-bags-plain-white/? [R=301,L]
但它不起作用。有人能帮我解决这个问题吗

如果我使用
RedirectMatch^(.*)/Misty\u Greyhttp://domain.com/paper-merchandise-bags-plain-white/
它将被重定向到
http://domain.com/paper-merchandise-bags-plain-white/?7

是否有办法删除?7以使查询字符串不可见

请尝试以下命令

//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/?