Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I would like to set up a server similar to Google's. Their domain acts like a double domain, like you can use these URLS, "play.Google.com" or "apps.Google.com", to go to different sites.. For example, my domain would now be "my_domain.com" but i would like another one to be "domain2.my_domain.com". My question is,what is this officially called and how do i set it up? I'm not sure if you need two servers or just 1;

share|improve this question
    
Edited the title for you. I Added "sub-domain" to title to make this question more accessible when searching –  Julian Knight Jun 21 '12 at 16:16
    
Do you want to do this on your own PC, Mac or Linux server? Do you have root access or is it a shared server with a control panel? –  Anagio Jun 21 '12 at 19:41
    
thanks for the clearification i actually use shared hosting with a cpanel –  kdavis8 Jun 22 '12 at 6:50

3 Answers 3

To set up a sub-domain, you need access to the Domain Name Service that is the master for the domain.

You do not need two servers though sub-domains can be on different servers, they don't have to be.

When you purchase a domain name, you will normally get a web interface supplied by the registrar that will let you set up whatever sub-domains you like.

If your domain name is supplied by your ISP or a hosting service, they may not give you access to the DNS settings though you may be able to request that a sub-domain be added - it depends what service you've signed up for.

I would always recommend that you register domains through a specialist domain name registrar. That way, if you fall out with your ISP or hosting provider, you still have control over the domain name.

If you do have access to the DNS. You need to create an "A" record against the domain. It is pretty straight-forwards. As @John Conde said, if you can say what tools you are using, we could help further.

There are quite a few related answers that you'll see in the "Related" sidebar ->

share|improve this answer
    
i have godaddy as my registrar but i have fav.cc as my hosting provider –  kdavis8 Jun 22 '12 at 21:54

They're called subdomains and you don't need multiple servers to do this. Your control panel software should make this trivial to do. Tell us what software you're using (cpanel, plesk, etc) and I'll update my answer accordingly.

Instructions for setting up a subdomain in cPanel

You must first log into your cPanel hosting control panel - if you have lost or forgotten your username and/or password, you must email support and ask for the details (lost passwords will mean a password reset).

Once logged in, we will proceed with creating a sub domain in your cPanel web hosting control panel...

view the create a subdomain video tutorial

First, click on the Subdomains icon in the Domains section

You'll come to the Subdomains page where there will be an entry section to add a subdomain and a list of existing subdomains lower down the page.

Note: If you have created any addon domains, subdomain entries will also been shown for each addon so bear in mind that not all of the subdomains listed may not be just subdomains.

Add a subdomain

Now we will add a subdomain (using the example shown in the video tutorial above). Go to the Create a Subdomain section and enter the name of the subdomain in the entry box titled 'Subdomain'. In this example we enter the name 'max'. This will create a subdomain as follows max.yourdomainname.com. You can choose which domain in your hosting to add the subdomain to from the drop down list of domains immediately to the right of that entry box.

When you click on the next entry box titled 'Document Root' cPanel will automatically create an entry based on the name of the subdomain. This will always be created in your public_html folder. So in this case cPanel will place public_html/max in that entry box. You can change this to what you want but you must always create the subdomain in your public_html folder, so it can be public_html/anything. This is the folder in which files for that subdomain will be stored, so you can the reasons why cPanel would choose something relevant to the name of the subdomain - its easier to see what relates to what when viewing your folders and files.

Now click the 'Create' button and the sub domain will be added by cPanel, you will see the details on the next page which confirms details of the subdomain and folder in use. Click the 'Go Back' link to return to the Subdomains page where the subdomain will now be listed.

You can now add files for that subdomain to the folder created for it.

(source)

share|improve this answer
    
i use a Cpanel through shared hosting –  kdavis8 Jun 22 '12 at 6:51
    
Answer updated with instructions for cpanel –  John Conde Jun 22 '12 at 11:27

It is easy, well sort-of, they are called subdomains and most cheap providers will let you create anywhere from 0 to unlimited of them on your web-service. Pretty much how they work is you get a server and get it a static ip. Then, you create an A record that points to that static ip. The web-server such as Apache2 then will take a look at all things coming in on that domain and will route it appropriately to the directory on the system. It is also possible to have multiple servers is just to create A records with a fully-qualified domain so something like server1.mydomain.com. IN A 127.0.0.1 It is easy to setup DNS via something like Amazon Route 53.

It is also intreresting to note that in the begginng the reason for the www in front of the domain was used to specify that it was the server named www on that domain that would answer the request. The same hold true today except it can now be omited or it can be answered by the same server.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.