Apache 如何重定向用“重写”创建的URL

Apache 如何重定向用“重写”创建的URL,apache,.htaccess,redirect,seo,rewrite,Apache,.htaccess,Redirect,Seo,Rewrite,我用重写模块创建了URL 这是命令: 重写规则^productos/+-.+.html电子商务/buscador.php?categoria=$2 示例URL 该网址工作良好,但现在我需要改变的网址。我认为使用重定向301是我的解决方案。但是当我尝试重定向URL时,该命令返回新的URL,但带有参数 命令是: 重定向301/productos/Verduras-2.html/productos/Verduras\u a\u domicilio-2.html 当我从google search访问U

我用重写模块创建了URL

这是命令: 重写规则^productos/+-.+.html电子商务/buscador.php?categoria=$2

示例URL

该网址工作良好,但现在我需要改变的网址。我认为使用重定向301是我的解决方案。但是当我尝试重定向URL时,该命令返回新的URL,但带有参数

命令是: 重定向301/productos/Verduras-2.html/productos/Verduras\u a\u domicilio-2.html

当我从google search访问URL时,浏览器返回带有参数的URL

有什么建议吗

谢谢

对于类似的URL,不要混合使用重定向和重写规则。我建议您只使用重写规则作为

此外,上述规则的顺序也很重要

RewriteEngine on

RewriteRule ^productos/Verduras-2\.html$ /productos/Verduras_a_domicilio-2.html [R=301,L]
RewriteRule ^productos/(.+)-(.+)\.html$ ecommerce/buscador.php?categoria=$2 [NC,L]