我需要将没有语言环境的URL重定向到具有语言环境的URL。 例: https://test.example.com/products/123/greate-product-> https://test.example.com/es/products/123/greate-product
我已经尝试了关于Apache的设置,但是它不起作用
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/es$
RewriteCond %{REQUEST_URI} !^/en$
RewriteCond %{REQUEST_URI} !^/es/$
RewriteCond %{REQUEST_URI} !^/en/$
RewriteCond %{REQUEST_URI} !^/es/.+$
RewriteCond %{REQUEST_URI} !^/en/.+$
RewriteCond %{REQUEST_URI} !^/content/servererror/.*
RewriteRule ^/(.*) https://%{HTTP_HOST}/es/$1 [R=permanent,L]