Php htaccess正则表达式将不包含lang xx的url重定向到与lang es相同的url

Php htaccess正则表达式将不包含lang xx的url重定向到与lang es相同的url,php,regex,.htaccess,redirect,Php,Regex,.htaccess,Redirect,我从来没有使用过htaccess重定向,我使用的是prestashop 1.3,并且在使用过程中复制了URL http://www.domain.com/catyegory/product.html http://www.domain.com/lang-es/catyegory/product.html http://www.domain.com/catyegory-1/product.html http://www.domain.com/lang-es/catyegory-1/product

我从来没有使用过htaccess重定向,我使用的是prestashop 1.3,并且在使用过程中复制了URL

http://www.domain.com/catyegory/product.html
http://www.domain.com/lang-es/catyegory/product.html

http://www.domain.com/catyegory-1/product.html
http://www.domain.com/lang-es/catyegory-1/product.html
这个问题在其他语言中不会出现,我需要将不包含任何lang xx的url重新定义为与lang es相同的url

我正在尝试,但不起作用

Redirect 301 !([ lang-es)(*.) http://www.domain.com/lang-es/$1

谢谢

您的表达式中有语法错误(无结尾
[
),您还应该使用
RewriteCond
获取“不以开头”表达式:

RewriteCond %{REQUEST_URI} !^lang-es/.*
RewriteRule (.*) http://www.domain.com/lang-es/$1

非常感谢你,我要试试