【发布时间】:2009-07-27 08:44:56
【问题描述】:
基本上,我想做的是重写所有 url,因为我们有许多不同的语言。我们有一个托管多个域的服务器。我们有 www.example.com、www.example.fr、www.example.de、www.anotherdomain.com、www.anotherdomain.de。我想要做的是使用额外的 url 参数 lang=en 将所有请求从 example.xxx 重定向到 www.example.com。这不应影响其他域,例如 www.anotherexample.com 等。
这不起作用:
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.de$
RewriteRule ^(.*)$ http://www.example.com/$1?lang=de [PT]
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.fr$
RewriteRule ^(.*)$ http://www.example.com/$1?lang=fr [PT]
更困难的是,ServerName 与主机名完全不同,它被称为 prod.migr.com。
任何建议将不胜感激。
【问题讨论】:
标签: apache mod-rewrite