0

如何将以domain.com/acme1/list-all-products.htmldomain.com/acme2/list-all-products.html等结尾的 URL 重定向到domain.com/acme1.htmldomain.com/acme2 .html。我尝试将这些行添加到我的 .htaccess 中:

RewriteCond %{QUERY_STRING} ^list-all-products.html
RewriteRule ^(.*)$ /$1? [R=301,L]

但我认为没有效果。我知道我想念一些东西。

4

1 回答 1

0

查询字符串不是您想要的。你不需要重写条件:

RewriteRule ^([^/]+)/list-all-products.html$ /$1.html [R=301,L]
于 2013-09-05T15:17:36.003 回答