【发布时间】:2010-08-06 15:22:03
【问题描述】:
我正在尝试将我博客的访问者重定向到法语或英语版本。 所以我做了这个 .htaccess :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#---------------------
# Language Redirection
#---------------------
# Checking if the redirection didn't occur yet
# Checking that the url doesn't begin with /en
RewriteCond %{REQUEST_URI} !^/en(.*)$
# Checking if the user is in english
RewriteCond %{HTTP:Accept-Language} ^en [NC]
# Redirecting from /the/url to /en/the/url
RewriteRule ^(.*)$ /en/$1 [L,R=301]
#----------------------
# Wordpress Redirection
#----------------------
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
基本上,如果他们是英文的,我想将来自 google 的访问者从 /my/article 重定向到 /en/my/article。 相反,有一个无限循环!由于最后一个 RewriteRule,我认为 REQUEST_URI 始终是 index.php。
有人做过吗?
非常感谢
【问题讨论】:
标签: apache wordpress .htaccess internationalization redirect