What Is A Subdomain And How Does It Work? How To Create A Subdomain
What is a Subdomain
A subdomain is a prefix added to your original domain name, like a domain within a domain, usually following subdomain.example.com. They behave very similarly to an addon domain and are often created to separate your website's different sections, such as blog.example.com or store.example.com. You can point them to a folder to host a website, just like a normal domain name.
- Accessing the Subdomain Menu
- Creating a Subdomain
- Hosting Only A Subdomain
- Restrict Subdomain Access to Addon Domains
Accessing the Subdomain Menu
Note: The Advanced tab will load your cPanel. Legacy accounts will feature a horizontal navigation bar at the top of the screen, while Bluerock account users will see a vertical navigation menu on the left-hand side of the screen. To learn more, please see Bluerock vs. Legacy.
Bluerock
- Log in to your Bluehost account.
- Click the Domains tab from the side navigation to the left.
- Click on Subdomains from the drop-down menu that appears.
- Hit on Add Subdomain button at the upper right corner of the screen.
Legacy
- Log in to your Bluehost cPanel account.
- Click the Domains tab from the navigation menu that stretches across the top of your screen.
- Click on Subdomains on the submenu.
Creating a Subdomain
- Enter the desired subdomain.
- Choose one of your Domain Names from the drop-down list.
- Enter the Document Root (this is the folder that contains the website you want to show). We recommend that you use the same name for this folder as your subdomain.
- Click the Add subdomain button.
Tip: You can point any subdomain to the root folder of any of your sites by simply placing the correct directory in the home folder box. But if you want to change where an existing subdomain is currently pointing at, please refer to Changing a Domain's Assignment.
Hosting Only A Subdomain
- In Bluehost, create the account with the domain name you purchased elsewhere.
Example: If you are setting up the domain subdomain.example.com, sign up for your account with the name example.com
- In your Bluehost cPanel, create the subdomain you need to host with us (i.e., "subdomain.example.com.")
- Contact the host of your domain name's zone file and have them point the A record for the subdomain to the IP of your Bluehost server.
Note: This should take somewhere between 24 to 72 hours to propagate, and your subdomain will be live on our servers.
Restrict Subdomain Access to Addon Domains
Each Addon Domain requires a subdomain. Using mod_rewrite, you can stop people from using the addon domain as a subdomain of the primary domain.
Put this in the .htaccess file located at the subdomains folder, changing the subdomain, primarydomain.com, and addondomain.com:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain.primarydomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.subdomain.primarydomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^addondomain.com$
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ http://www.addondomain.com/ [R=301,L]
If you need further assistance, feel free to contact us via Chat or Phone:
- Chat Support - While on our website, you should see a CHAT bubble in the bottom right-hand corner of the page. Click anywhere on the bubble to begin a chat session.
- Phone Support -
- US: 888-401-4678
- International: +1 801-765-9400
You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.