.htaccess 多语言htaccess文件(有限公司)

.htaccess 多语言htaccess文件(有限公司),.htaccess,multilingual,.htaccess,Multilingual,我想有一个多语言的网站。现在,我有两个域。第一个是主域。那是website.nl。我有一个域名别名,website.org。因此,这两个域共享同一个公共html文件夹 我想要的是: website.nl将使用文件/index.php/$1和 org将使用文件/gb/index.php/$1(因此,当url为website.org/test时,您将使用文件/gb/index.php/test(无url重定向) 我在stackoverflow的另一个主题中发现了以下内容: Options +Foll

我想有一个多语言的网站。现在,我有两个域。第一个是主域。那是website.nl。我有一个域名别名,website.org。因此,这两个域共享同一个公共html文件夹

我想要的是: website.nl将使用文件/index.php/$1和 org将使用文件/gb/index.php/$1(因此,当url为website.org/test时,您将使用文件/gb/index.php/test(无url重定向)

我在stackoverflow的另一个主题中发现了以下内容:

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{HTTP_HOST} website.org
RewriteRule ^(.*)$ /gb/index.php [L]

RewriteRule ^(.*)$ /index.php/$1 [L]
但是这个htaccess文件不起作用。我会得到一个500错误。仅此而已


有人能看到出了什么问题吗?

您的规则正在循环,否则这两条规则将互相干扰并无限期循环(例如,请求
/foo
将导致
/index.php/index.php/index.php/index.php…等
从而返回500)。您需要添加一些条件来停止循环。请尝试将条件和规则更改为:

RewriteCond %{HTTP_HOST} website.org
RewriteCond %{REQUEST_URI} !^/gb/index.php
RewriteRule ^(.*)$ /gb/index.php/$1 [L]

RewriteCond %{REQUEST_URI} !^/gb/index.php
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule ^(.*)$ /index.php/$1 [L]