λ׃:   IXWebHosting IXWebhosting使用 IXWebhosting使用图文帮助 怎么在IXWebHosting主机提供的独立IP上绑定多个域名

怎么在IXWebHosting主机提供的独立IP上绑定多个域名

ixwebhosting.cn

IXWebHosting的每个主机都提供了独立IP,其中Unlimited主机更是提供了15个独立IP。不过独立IP再多也会用完的,如果你的网站数目大于IXWebHosting主机提供的独立IP数, 那你只能使用共享IP了。不过由于国内环境的特殊系,如果你的共享IP不幸被 “墻”了,那么你的网站也会被牵连。那么能不能在自己的IP独立上绑定多个网站呢? 当然是可以的:

我们以www.ixwebhosting.cn www.ixwebhosting.com.cn 两个域名为例。

  1. 首先我们绑定www.ixwebhosting.cn 这个域名到IXWebHosting,当然使用一个独立IP,假设被分配的IP为96.0.18.151。www.ixwebhosting.cn 对应的网站根目录为 /xxx/ixwebhosting.cn/
  2. 然后对于www.IXWebHosting.com.cn这个域名,我们就不绑定到IXWebhosting主机了,我们直接设置A记录到96.0.18.151 或者CName记录到www.ixwebhostsing.cn
  3. 这时候我们访问www.ixwebhosting.com.cn 内容是和www.ixwebhosting.cn一样的。
  4. 在/xxx/ixwebhosting.cn/下建立两个目录 ixwebhosting.cn 和ixwebhosting.com.cn 分别用来存放www.ixwebhosting.cnwww.ixwebhosting.com.cn 的网站内容
  5. 在/xxx/ixwebhosting.cn/下建立一个.htaccess文件 内容如下:

RewriteEngine on
  # ixwebhosting.cn
RewriteCond %{REQUEST_URI} !^/ixwebhosting.cn/.*
RewriteCond %{HTTP_HOST} ^ixwebhosting.cn$ [OR]
RewriteCond %{HTTP_HOST} ^www.ixwebhosting.cn$
RewriteRule ^(.*) /ixwebhosting.cn/$1 [L]

# ixwebhosting.com.cn
RewriteCond %{REQUEST_URI} !^/ixwebhosting.com.cn/.*
RewriteCond %{HTTP_HOST} ^ixwebhosting.com.cn$ [OR]
RewriteCond %{HTTP_HOST} ^www.ixwebhosting.com.cn$
RewriteRule ^(.*) /ixwebhosting.com.cn/$1 [L]

自此你所有的设置已经完成了,www.ixwebhosting.cnwww.ixwebhosting.com.cn 使用了同一个IP,但是这两个域名对于了不同的根目录 /xxx/ixwebhosting.cn/ixwebhosting.cn 和 /xxx/ixwebhosting.cn/ixwebhosting.com.cn

当然如果你想在一个独立IP上绑定多个域名也是可以的,只要在.htaccess下多加一个域名设置就可以了。(依葫芦画瓢)

 

关于IXWebhosting

十年如一日, IXWebHosting始终如一的为客户提供顶级的主机服务,无论是对中小商务用户、大型公司或者个人,IX Web Hosting主机都是你的不二之选。

Products and Services

  • VPS
  • 虚拟主机

License agreement

IXWebhosting社区

IXWebhosting社区

IXWebHosting@1usa