Multiple Domains to One Virtual Host | Wildcard Host (shared hosting)?

女生的网名这么多〃 提交于 2019-12-07 10:55:53

问题


I have the following task: Create one website which is accessible with 20 different domains names.

Same files, same folder, same ip.

Question (shared hosting): Can this be accomplish with a bare cname's pointing to the same common subdomain or do we need one static ip for all?

The problem is sure shared hosting and I'm trying to avoid creating manually "cpanel addon domains" one by one. Shared hosting doesn't allow to modify httpd conf which allows me to create a wildcard virtual host for an IP.

I guess my question is auto answered; I'll need a static unless I'm only using subdomain's w wildcard, which works on shared hosting. "*.domain.com", "two.domain.com", "three.domain.com" => directory/


回答1:


I think you have answered your own question, the options open to you are

  • Add ServerAlias entries to the vhost config, via whatever means available to you
  • Ensure the default virtual host on the target IP is the one which handles your site



回答2:


  1. If you use a CNAME (or indeed an A record pointing to the same IP address) then you must, as Paul says, either have ServerAlias entries in httpd.conf, or point them at the default virtual host

  2. If you can't do that, host 19 of the domain names at some other web host, and then use HTTP redirect to get users to the "preferred" domain name. However if you do this then the domain name will change in the user's address bar.



来源:https://stackoverflow.com/questions/621819/multiple-domains-to-one-virtual-host-wildcard-host-shared-hosting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!