常规经验.htaccess中的所有页面重定向

时间:2019-04-16 12:27:24

标签: .htaccess

现在我们的网页有4个TLD:

example.de
example.com
example.nl
example.fr

现在,我想将CMS(Contao)的设置更改为仅包含一个TDL和语言简称:

example.com/de/
example.com/en/
example.com/nl/
example.com/fr/

现在,如果您输入example.com,Contao会检测到浏览器语言并短期内重定向到正确的语言。

这是重定向的正确方法吗?

RewriteCond %{HTTP_HOST} domain\.de$ [NC]
RewriteRule ^((?![a-z]{2}/).*)$ /de/$1 [R=301,L]

RewriteCond %{HTTP_HOST} domain\.com$ [NC]
RewriteRule ^((?![a-z]{2}/).*)$ /en/$1 [R=301,L]

RewriteCond %{HTTP_HOST} domain\.nl$ [NC]
RewriteRule ^((?![a-z]{2}/).*)$ /nl/$1 [R=301,L]

RewriteCond %{HTTP_HOST} domain\.fr$ [NC]
RewriteRule ^((?![a-z]{2}/).*)$ /fr/$1 [R=301,L]

寻求帮助

0 个答案:

没有答案