如果没有,则将区域设置参数添加到URL

时间:2019-04-18 15:15:20

标签: apache mod-rewrite

我需要将没有语言环境的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]

0 个答案:

没有答案