How do I create subdomains?
Every Web hosting plan we offer includes unlimited subdomains. Subdomains let you display different Web sites to visitors who use different "host names" in the Web browser address bar.
For example, if your domain name is "example.com", you could display a different Web site to people who visit "sales.example.com" and "www.example.com". Another use of subdomains is creating personal Web sites for family members, such as "robert.example.com" and "mollie.example.com".
On this page:
- Creating subdomains
- Subdomains and "www."
- Subdomains and Microsoft FrontPage
- Subdomains and mod_rewrite
- Subdomains and e-mail
- Subdomains with different directory names
- Treating "www" as a subdomain
- Disabling subdomains
Creating subdomains
Our subdomain feature is easy to use: just create a new directory (folder) at the top level of your Web site directory. The new folder will instantly become a subdomain.
In other words, it's easy to create a subdomain like sales.example.com. Just add a folder named sales to the top level of your Web site, then put a normal index file in that folder.
You can create unlimited subdomains at no extra charge, and they start working immediately.
Make sure to name your directory so that it only contains lowercase letters, numbers and hyphens. It shouldn't contain any uppercase letters, spaces, dots, or other unusual characters. For example:
- If you name your directory "sales", it can be accessed as http://sales.example.com/, http://www.sales.example.com/, http://Sales.example.com/, http://www.Sales.example.com/, etc. As long as the folder name you create is all lowercase, you can use lowercase or uppercase letters in the URL to access it later.
- If you name your directory "Sales", it won't work as a subdomain because the name contains an uppercase letter. Use only lowercase letters for the folder name.
- If you name your directory "internal sales", it won't work as a subdomain because the name contains a space. Change it to a name like "internal-sales".
Subdomains and "www."
Using "www." in a Web browser is optional with subdomains. For example, "http://sales.example.com/" and "http://www.sales.example.com/" would show the same thing.
Subdomains and Microsoft FrontPage
If you're using Microsoft FrontPage to publish your site, some FrontPage functionality, such as guestbooks and feedback forms, will not work properly with a subdomain.
If you are using FrontPage functions such as guestbooks or feedback forms on pages within a subdomain, you can avoid this problem by using links that refer to the subdomain folder as a directory of your main site, rather than directly as a subdomain URL.
For example, if you use a FrontPage feedback form at this address:
http://sales.example.com/feedback.htm
... it won't work properly due to FrontPage limitations. However, you can create a link to the same feedback form page using this version of the address:
http://www.example.com/sales/feedback.htm
... and it will work.
Subdomains and mod_rewrite
If you're using Apache mod_rewrite RewriteRules in a .htaccess file in a subdomain directory, you'll usually need to also add a line like this to your .htaccess file:
RewriteBase /
This tells the Apache Web server to avoid prepending the subdomain directory name to the rewritten address.
Subdomains and e-mail
For advanced customers, we also support e-mail for subdomains, with the restriction that messages sent to an address @subdomain.example.com will be treated just like messages sent to the same address @example.com.
For example, if you want mail sent to "example@mail.example.com" to be handled as if that message had been sent to "example@example.com", that's possible.
To make this work, you'll need to add a DNS "MX" entry for the subdomain, pointing it to "mx.tigertech.net". (The MX priority and "time to live" don't matter.) Adding that custom DNS entry makes sure that incoming mail for the subdomain will be routed to our mail servers, and it also tells our mail system to treat the subdomain as a valid addresses. Once you do this, you can even use that subdomain address as the "from" address in outgoing mail, too.
Adding DNS entries is considered a fairly advanced task; if you prefer that we do it for you, just contact us. We'll be glad to help.
Subdomains with different directory names
The method described above — creating a directory called "sales" when you want a subdomain called "http://sales.example.com/" — is quick and easy.
Occasionally we're asked how to create a subdomain that does not use the same directory name. Technically advanced users can do this by creating a symlink using the shell.
For example, to make "http://sales.example.com/" use a directory named "my_private", you could create a new symlink named "sales" pointing to "my_private":
$ cd /var/www/html/ex/example.com $ ln -s my_private sales
Treating "www" as a subdomain
Normally, "http://www.example.com/" is not treated as a subdomain. Even though the visitor is using "www" as part of the address, our servers will not look for a directory named "www" and try to use the files it contains. Instead, our servers will use the files at the top level of your site.
This makes sure "http://example.com/" and "http://www.example.com/" are handled identically, which is almost always what you want to happen.
In rare cases, technically advanced users may wish to treat "http://www.example.com/" as a "www" subdomain, just like any other subdomain.
As an example, if you've divided parts of your Web site into different projects that are maintained by separate systems or people, you may want to make sure that your "www" project is in a separate directory of its own that doesn't contain any other project directories.
You can do this by adding an empty file with this special name to the top level of your Web site (or asking us to do so):
.tigertech-treat-www-as-subdomain
If that file exists, requests for "http://www.example.com/" will use a "www" directory if possible.
Note that doing this may require you to make other small changes to your site. For example, if you place a "cgi-bin" directory inside your new "www" directory, you'll need to enable it as described on the "Making Additional Directories Executable" page, just like a "cgi-bin" directory on any other subdomain.
In addition, this change won't affect requests for "http://example.com/", because those don't include the "www". You may wish to redirect those visitors to the www version of your site.
Disabling subdomains
If you don't want our servers to accept arbitrary hostnames as subdomains, you can disable the feature using a .htaccess file. These lines, for example, will redirect any hostname other than “www.example.com”:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.example.com$ [nocase]
RewriteRule ^(.*) http://www.example.com/$1 [last,redirect=301]
We'll be glad to do this for if you wish; just contact us.
