3

如果可能,我想使用 htaccess 执行以下操作。

该网页以这种方式工作,您可以通过 获取索引文件domain.de/de/start和通过domain.de/en/start.

如果用户访问domain.com我希望他结束domain.de/en/而不是domain.de/de/所以我需要重写对domain.com的所有请求但不请求domain.com/xx/somethingtodomain.de/en/

谢谢。

4

2 回答 2

3

如果我清楚地了解您,您只想重定向但http://domain.com/不想重定向http://domain.de/en/http://domain.com/XX/YY

将此代码放入您的 .htaccess 中:

Options +FollowSymLinks -MultiViews
RewriteEngine on

RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^$ http://domain.de/en/ [L,R=301]
于 2012-01-06T15:02:47.563 回答
1

Try to use HTTP_HOST and rewritecond

RewriteCond %{HTTP_HOST}=domain.de
RewriteCond %{REQUEST_URI}=/              % redirect only the root
RewriteRule ^/$ /de/start [L]             % to /de/start

RewriteCond %{HTTP_HOST}=domain.de
RewriteCond !%{REQUEST_URI}=/             % no root
RewriteCond !%{REQUEST_URI}=/[a-z]{2}/.*  % except /xx/ directories
RewriteRule ^/.*$ /de/$1 [L]              % push the user in the /de/ directory
于 2012-01-06T14:51:23.657 回答