Adding a subdomain for an app

You can have only one app per origin. One way to handle this is to use a subdomain for each app. Each subdomain is a different origin, for example app1.example.com, app2.example.com. Creating a subdomain is usually easy to do, and it is free with most domain hosting providers. Typically the hosting provider allows a certain number of free subdomains. Some examples of adding subdomains are given below.

Generic instructions for adding a subdomain

  1. Log in to your hosting provider's administrative console for your domain.
  2. Find the page that deals with configuring domains.
  3. Locate the capability to add a subdomain.
  4. Add the subdomain, specify where the subdomain's files will be stored, and save your changes.
  5. Put your app's files on the server where you specified in step 4.
  6. Verify that the new subdomain exists by going to it in a browser.

The following sections explain how to add a subdomain with specific hosting tools.

Adding a subdomain with cPanel

Here is an example of creating a subdomain with cPanel, which is a web hosting control panel that is used by many hosting providers.  Your cPanel page might look different, depending on how it has been configured, but this should give you an idea.

  1. Log into cPanel.
  2. Scroll down and find the Domains section.

  3. Click Subdomains to open the Subdomains page.

  4. Type the subdomain name in the Subdomain box. For this example we will use "newsubdomain".
  5. Click in the Document Root box. This displays the path where the files for the new subdomain will be stored. In this example we will use /public_html/newsubdomain. You can change this if you want your app's files in another location. For example, if the files for your app are in public_html/gamedev_com/games/coolgame/, then type that path in the Document Root box.Document root
  6. Click the Create button and you should get a confirmation message.
  7. Put your app's files in the directory that you specified for the subdomain. For this example we will use a simple HTML file named index.html that displays "This is on a new subdomain!"
  8. Confirm that the new subdomain exists. Open a browser and type in the new domain name. In this example the following appears:

    New subdomain in browser

Adding a subdomain with Go Daddy

Here is a video of how to add a subdomain to a domain hosted by Go Daddy.

 

Attachments

File Size Date Attached by
cPanel Domains section
none
12212 bytes 2012-09-12 19:45:25 MarkGiffin
cPanel Subdomain page
none
9659 bytes 2012-09-12 19:51:21 MarkGiffin
Document root
Path to app files
4097 bytes 2012-09-15 13:13:52 MarkGiffin
New page on subdomain
New page on subdomain
9624 bytes 2012-09-15 13:22:34 MarkGiffin

Document Tags and Contributors

Tags:
Contributors to this page: Sheppy, MarkGiffin, chrisdavidmills
Last updated by: chrisdavidmills,