Call Toll Free: 877-374-6781
Mail Login | Account Login | Contact Us | Place Order

 

Support Center » Knowledgebase » How to make a sub-domain point to a sub-directory using ISAP_Rewrite.
 How to make a sub-domain point to a sub-directory using ISAP_Rewrite.
Solution

Using ISAPI re-write

To clarify some terminology a sub-domain is a DNS entry whereby a host name is applied to a second/third level domain. For instance, "www.ephost.com" is a sub-domain to "ephost.com". You may add as many sub-domains as you would like to your DNS settings. You can add a sub-domain by simply adding an "A" record or "CNAME" to a domain using the Edit DNS Settings options under "domains". A "website" is a unique entry in the web server to serve up a particular website based upon a particular domain/sub-domain. You are allocated a certain amount of websites on your web hosting plan.

Helm Users:

Adding a sub-domain will automatically create a website and point it to a sub-directory of the same name within your primary domain. It will not use any of your hosted domains allocation. There may be some issues with this because Google sees each unique sub-domain as an entirely separate website (whether it is or not), and since content is often the same, these websites may be penalized for having duplicate content across multiple sites. This is why most websites issue a 301 redirect for the second-level domain to the third-level host name "www".

DotNetPanel Users:

Our new control panel, DotNetPanel will NOT automatically create a website for a sub-domain. It will only create a DNS entry. Your can optionally create a website based upon a domain or sub-domain-- thus giving you greater flexibility in how a sub-domain is handled (website or no website - email or no email). The newly added website will apply towards your hosted website allocation.

Work-Around for DotNetPanel Users:

There is still a way of achieving the "old" Helm way if you would like. After adding an "A" record for the sub-domain in the DNS zone for the primary domain you can use ISAPI_Rewrite 2 to rewrite sub-domain URLs so they point to a sub-directory without it showing in the URL. You can repeat the rules to add additional sub-sites. If you create a file called httpd.ini (using notepad) and put it in your WWWROOT folder for the website with the sub-domains you can add the following code to create a rule for it to point to a sub-directory off the website. You can duplicate the second part of the rule to add more as needed. If you plan to install a web application (e.g. DotNetNuke or WordPress), you will want to create a Virtual Directory on the website pointing to the same folder so IIS will enable it for applications. Note, we will be upgrading to the latest version of the URL rewriting tool sometime soon. Please pay close attention to make sure this rule will be compatible with the new version.

[ISAPI_Rewrite]

#Rules used to emulate a website in a sub-directory (old sub-domain way).

#Rename this file httpd.ini and place in the main website WWWROOT folder.

#Fix missing slash char on folders.

RewriteCond Host: (.*)

RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [I,R]

#Emulate an additional website.

RewriteCond Host: (?:sub-domain\.)?your-domain\.com

RewriteRule (.*) /your-sub-dirdectory$1 [I,L]

We don't guarantee this method will work 100% of the time and in 100% of situations. We still recommend adding a sub-domain per the control panel thus creating a new website for SSL, dedicated IP, SEO and restoration reasons.



Article Details
Article ID: 220
Created On: Jun 14 2010 01:16 PM

 This answer was helpful  This answer was not helpful

 Back
 Login [Lost Password] 

This login is for the support section of our website only. The email address or password MAY differ from your hosting account if you are a hosting customer. Note: You can always just send an email support@ephost.com to open a new ticket.

Email:
Password:
Remember Me:
 
 Search
 Article Options
Home | Register | Submit a Ticket | Knowledgebase | Troubleshooter | News | Downloads
Language:

Copyright 2009 © EPhost, Inc. 2204 Garnet Avenue Suite 302 San Diego, CA 92109 . 858-433-2818 . 877-374-6781
Terms of Service . Acceptable Use Policy . Privacy Policy . Site Map