TheUberMonkey who found this solution)
This tutorial comes in 2 parts:
- Creating the CNAME
- Editing your .htaccess file
1. Creating the CNAME
-
- Log in to https://ops.powweb.com
- Click on 'Packages' then in the list of packages, click on 'DNS'
- In the DNS screen, click on the link at the bottom that says 'Add CNAME'
- In the 'Alias' field, type in the name of your subdomain (i.e. if you want your subdomain to be chat.yourdomain.com then type in 'chat'). In the 'Hostname' field, type in 'yourdomain.com.' where yourdomain is the name of your domain. NOTE: There must be a period at the end!! Click 'Save'. The CNAME will become active when the name servers are reloaded (at noon and midnight daily).
2. Editing your .htaccess file
-
- If you already have a .htaccess file open it, otherwise create a new file called '.htaccess'
- Assuming your domain name is www.blah.com and you want a subdomain chat.blah.com that points to a folder in your htdocs/ folder called chat/ add these lines to your .htaccess file:
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} chat.blah.com
RewriteCond %{REQUEST_URI} !chat/
RewriteRule ^(.*)$ chat/$1 [L]
Note: If you want the subdomain chat.blah.com to point to a folder in your htdocs called mychatfolder/ then you would add these lines:
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} chat.blah.com
RewriteCond %{REQUEST_URI} !mychatfolder/
RewriteRule ^(.*)$ mychatfolder/$1 [L]
3. Save the file and upload it to your htdocs/ folder.
Multiple Subdomains
1. Create the CNAME for the second subdomain as in part 1 above.
2. Open your .htaccess file. Repeat the last 3 lines, i.e.
RewriteCond %{HTTP_HOST} secondsubdomain.blah.com
RewriteCond %{REQUEST_URI} !folder/
RewriteRule ^(.*)$ folder/$1 [L]
3. Save the file and upload it to your htdocs folder.
*Pointing your subdomain to a file (not a directory) *
Use these lines instead:
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} chat.blah.com
RewriteCond %{REQUEST_URI} !chatfolder/filename.cgi
RewriteRule ^(.*)$ chatfolder/filename.cgi$1 [L]
This will allow you to point to any filename, be it .html, .php. cgi, .pl, etc.