htaccess的重定向域别名/绑定域名 [英] .htaccess redirect domain alias / parked domain
本文介绍了htaccess的重定向域别名/绑定域名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个htaccess的相关问题。
I have a .htaccess related question.
例如,如果我有两个域名,a.com和b.com。都指一台主机(b.com是a.com的域别名)。我想这访问者访问a.com将被称为URL以WWW(http://www.a.com)。至于 http://b.com 的游客将被提交给WWW网址上(http://www.b .COM)。
For example, if I have two domain, a.com and b.com. All referring to one host (b.com is domain alias of a.com). I want visitor that visit a.com will be referred to url with www (http://www.a.com). As for the visitor of http://b.com will be referred to the www url (http://www.b.com).
我怎样才能做到这一点跟的.htaccess ??
How can I do this with .htaccess??
谢谢,任何帮助将非常AP preciated:)
Thanks, any help will be much appreciated :)
推荐答案
您可以尝试用2重写规则
You could try with 2 rewrite rules
RewriteEngine On
RewriteCond %{HTTP_HOST} ^a\.com$ [NC]
RewriteRule ^(.*)$ http://www.a.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^b\.com$ [NC]
RewriteRule ^(.*)$ http://www.b.com/$1 [L,R=301]
这篇关于htaccess的重定向域别名/绑定域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文