With the development of the Internet and the size of its own website, and other reasons, sometimes you may need to bind multiple domain names in one space.
The problem is, if the number of bound domain names is not much of the cost, space vendors in order to save operating costs, the general will limit the number of binding domain names, generally only about 3-5. Some outrageous point even only to bind two domain names, want to more binding and pay extra. So the webmaster in the choice of virtual space when you need to pay attention to the domain name can be bound number is how good, it is best to bind several domain names and real-time applications can be effective. So how to bind multiple domain names? And some methods do not support subdirectories at all, and what should be done?
In fact, there are many ways to bind multi-space, and do not support sub-directories do not fear! A space binding multiple domain name to do multiple stations, some friends in order to save money need to install multiple sites in a space, so in space bound several domain names, but access to the same content, how to let different domain names to access different content?
If you place multiple stations in a single space, the name of the site will be added to the address bar after the domain name is entered. For example, if you enter a.com, the address bar will jump to www. a.com Red file is the name of the folder where the station is placed in the space.
Method One: (This method is widely used on the network) JS implementation of a space to install multiple Web sites method
1. Bind www. a.com and www. b.com/, respectively, in space.
2. Upload the www. a.com website file to the root directory and upload the www. B.Com website to the./bbb/Directory
3, save the following code as Domain.js, and then upload to the spatial root directory
Program code
Switch (location.host) {
Case ' www. B.Com ':
Location.href=http://www. b.com/bbb/
Break }
4. Add program code between 5. When you enter WW W. A.com Access does not see any changes, but when you enter W ww. B.Com Access, the browser automatically jumps to W ww. b.com/bbb/. This enables the same space to install two sites, to implement multiple sites can and so on.
Method two (personal recommendation): with the server. Transfer ("") to implement a method for multiple stations in a space
You first bind all your domain names to your virtual host, and then add the following code to the index.asp (home file) in the root directory of the virtual host:
<% sn=lcase (Request.ServerVariables ("SERVER_NAME")) ' is used to get the domain name accessed by the user and converted to lowercase if sn= ' w ww. Abc.net "or sn=" yuxicn.net "then server. Transfer ("default1.asp")
If sn= "W ww. Def.net "or sn=" zxks.net "then server. Transfer ("index.html")
I hope the above method can help the friends who need to bind more space,How to register a website domain name? These two methods are also one of the ways to choose the domain name, whether you are registered CN domain name or registered COM domain name, do not worry, and there is no sub-directory restrictions!
How do you want to bind multiple domain names in one space?