问题原文
原帖链接 · InterLinked · CC BY-SA 4.0
I've been using a free web host that gives me a free subdomain. In addition to that, I can create two subdomains off of that.
Recently I acquired some actual top-level domains. However, the domain provider seems fairly limited. My only two options for URL forwarding are:
- Frame (cloaking) - which puts the entire site in an iframe
- Redirect HTTP 301 forwarding
The former involves iframes and breaks everything about the web that makes sense, and the latter involves simply going to a different domain. I'd like to be able to simply point the new domain at the current free subdomain, or any subfolder of that domain and have it transparently act as the root.
Essentially, the free server would just host the file and the domain would point to. I'm trying to avoid having purchasing a server to put the files on.
I think an "add on domain" would work. But I am only able to create 2 of them with the free host. So it seems like I would only be able to use 2 domains with the host.
Is there some service I can use that will map the server root to the appropriate folder and so on that I could use so that I host many different domains in different subfolders and somehow point the domains each to a different folder? Or would I need my own web server where I have more granular control over such options?
Possibly related to: Is it possible to use domain forwarding with masking without the use of iframe?
已采纳解答
原帖链接 · Stephen Ostermiller · CC BY-SA 4.0
There is no way to point a domain at your server transparently without the cooperation of your web host. To serve content from a domain you must:
- Set the DNS records to point the domain to the IP address of your hosting service. These are usually
Arecords, but can beCNAMErecords forwwwand other subdomains. - Configure the web server look at the
Host:header of HTTP requests and direct those requests to the files or code that power that web site. This is usually done by adding<VirtualHost>directives to Apache or by using "add on domains" in hosting front end packages like cPanel.
If your web host doesn't allow you to configure their web server for domain names, there isn't a lot you can do. Your only options are the redirect and framing options.
The good news is that web hosting is not very expensive. Finding web hosting should cost much less than other expenses you already have: registering domain names, and maintaining an internet connection to your home or mobile device.
- Domain registration for three domains: $25 to $50 (USD) per year
- Home broadband connection: $300 to $1800 per year
- Service for single mobile phone: $200 to $700 per year
- Basic web hosting that allows a reasonable number of add on domains: $30 to $100 per year
Free web hosting services are notoriously unreliable:
- They are often slow.
- They may inject ads and "powered by" into your pages.
- They won't be around forever. Your free web hosting will shut down and leave you scrambling to find another host.
- If you use their free subdomain, you probably won't be able to keep it after you stop using them. You will have to start all over with SEO, links, and bookmarks that have been driving traffic to your site.
- Search engines don't like ranking content on free hosting and free subdomains because they see lots of spam created there.
I'd urge you to find some cheaper hosting plan with good reviews. It won't break your budget. It will be a lot better than free hosting.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
