<VirtualHost *:80 />
# catch all DNS to be redirected here
ServerName redirect.domain.co.in
ServerAlias domain.co.in
ServerAlias domain.org
ServerAlias domain_co_in.com
Redirect permanent / http://www.domain.co.in/
</VirtualHost>
<VirtualHost *:80 />
# The real VH with only one name
ServerName www.domain.co.in
(...)
</VirtualHost>
You do not need mod-rewrite complexity to do that, the most basic configuration will do the job better (simplier=better).
Make one Virtualhost, containing all domains to be redirected (one in ServerName the others in ServerAlias). Inside it use Redirect to the right one, where you use only one ServerName.
<VirtualHost *:80 />
# catch all DNS to be redirected here
ServerName redirect.domain.co.in
ServerAlias domain.co.in
ServerAlias domain.org
ServerAlias domain_co_in.com
Redirect permanent / http://www.domain.co.in/
</VirtualHost>
<VirtualHost *:80 />
# The real VH with only one name
ServerName www.domain.co.in
(...)
</VirtualHost>
发布评论
评论(3)
仅重写此域:
要在一条规则中重写多个域:
To rewrite just this domain:
To rewrite for multiple domains in one rule:
在网络根目录中创建一个 .htaccess,
create a .htaccess in the web root,
您不需要修改复杂的重写来做到这一点,最基本的配置将更好地完成工作(更简单=更好)。
创建一个虚拟主机,其中包含要重定向的所有域(一个位于
ServerName
中,其他位于ServerAlias
中)。在其中使用Redirect
到正确的位置,您只使用一个 ServerName。You do not need mod-rewrite complexity to do that, the most basic configuration will do the job better (simplier=better).
Make one Virtualhost, containing all domains to be redirected (one in
ServerName
the others inServerAlias
). Inside it useRedirect
to the right one, where you use only one ServerName.