Mobile app version of vmapp.org
Login or Join
Vandalay111

: "There is no subdomain here." error in creating (one/multi)-level sub-domains Objective: I want to create multilevel sub-domains. For example, I've a domain like "domain.com," and now I want to

@Vandalay111

Posted in: #ControlPanel #DnsServers #MultiSubdomains #Redirects #UrlRewriting

Objective:

I want to create multilevel sub-domains. For example, I've a domain like "domain.com," and now I want to create some sub-domains for it.

It should be noted that what I'm working on it, belongs to a company and that company has a Shared IP not a Dedicated IP.



Creating Sub-domain Automatically by Adding a Pointer:

In my host provider control panel (WebsitePanel [WSP] {Download web page}) that is based on the IIS Server, I can create one-level sub-domains as follows:


Click on the "Web Sites" option by hovering mouse on the "Web" section.



Figure 1 - Getting access to the "Web Sites" page
Select one of the pre-added websites from the list of displayed websites in the "Web Sites" page.



Figure 2 - Getting access to the properties' page of one of the pre-added web sites
Click on the "Add Web Site Pointer" in the "Web Site Properties" page.



Figure 3 - Going to the "Add Web Site Domain Pointer" page
Enter "Web Site Pointer", select one of the pre-added domains from drop down list and click on the "Add Pointer" button.



Figure 4 - Adding a Web Site Pointer
Create a Folder/Directory with the same name who has been entered for the sub-domain in the root Folder/Directory of the selected domain.



Figure 5 - Creating a Folder/Directory with the same name (example) who has been entered for the sub-domain in the root Folder/Directory of the selected domain


Green Box: Added Folder/Directory with the same name (example) who has been entered for the sub-domain



When I do that, it automatically adds a record in the DNS Zone Records as "EnteredNameForSubDomain A SelectedDomainIP"; and I can access that sub-domain.

And I was thought that adding a pointer for creating sub-domains just adds the above-mentioned example about adding a sub-domain in the DNS Zone Records; however, it does something else too that I don't know what is that!!!

Furthermore, it doesn't allow to add sub-domains by using * Wildcard, or Dot(s) [.] for creating multilevel sub-domains.



Creating Sub-domain Manually:

In this situation, when I faced with it, I thought that I could add them (multilevel sub-domains) manually as follows:


Click on the "Domain" section link.



Figure 6 - Getting access to the "Domains" page
Select a pre-added domain from the list of displayed domains in the "Domains" page.



Figure 7 - Getting access to the "Edit Domain" page of one of the pre-added domains
Click on the "Edit DNS zone records" under the DNS section in "Edit Domain" page.



Figure 8 - Going to the "DNS Zone Records" page
Click on the "Add record" button in the "DNS Zone Records" page.



Figure 9 - Going to the "Add Record" section of the "DNS Zone Records" page


Green Box: Automatically added A record with the same name (example) who has been entered for the sub-domain in the "Add Web Site Domain Pointer" page
Top Red Box: Manually added A record with the name "test" for a one-level sub-domain
Bottom Red Box: Manually added A record with the name "test1.test" for a two-level sub-domain

Select A "Record Type," enter desired "Record Name" and "IP," and then, click on the "Save" button.



Figure 10 - Adding a DNS Zone Record

The list of the available Record Types in my host provider control panel (WebsitePanel) is as follows:


A
AAAA
MX
NS
TXT
CNAME
SRV




Figure 11 - The list of the available Record Types in my host provider control panel (WebsitePanel)
Create the Nested Folder(s)/Director(y/ies) with the same name who has been entered for the multi-level sub-domain in the Correct Folder(s)/Director(y/ies) of the root Folder/Directory of the selected domain. For example, if I've created a one-level sub-domain before as follows:

subdomain.domain.com

I must add a Folder/Directory with the name "subdomain" in the root Folder/Directory (wwwroot) of the selected domain (domain.com) as follows:

wwwroot -> subdomain

And now, if I've created another sub-domain under the previous created sub-domain (subdomain) as follows:

subdomain2.subdomain.domain.com

I must add a Folder/Directory with the name "subdomain2" in the "subdomain" Folder/Directory of the selected domain (domain.com) as follows:

wwwroot -> subdomain -> subdomain2



Figure 12 - Creating two Folders/Directories with the same name (test -> test1) who has been entered for the (one/two)-level sub-domain in the root Folder/Directory of the selected domain


Red Box in Figure 5: Added Folder/Directory with the same name (test) who has been entered for the (one/two)-level sub-domain
Red Box: Added Folder/Directory with the same name (test1) who has been entered for the two-level sub-domain



However, it doesn't work, and I don't know why?!

Then, I tested creating a one-level sub-domain manually without using "Add Pointer" feature, and it didn't work too!!!



Trying Another Method:

After facing with these things, I tried another thing that I explain it now.

I tried to creating some sample URL Redirect Rules in web.config file as follows:

URL Redirecting for two-level sub-domains:

<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to 2nd sub-domain of domain.com" stopProcessing="true">
<match url="^([^/]+)/(.*)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^(w([w-]*w)*).(w([w-]*w)*).(domain.ir|domain.com)/?" ignoreCase="true" />
</conditions>
<action type="Redirect" url="http://domain.com/{C:3}/{C:1}/{R:2}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>


URL Redirecting for three-level sub-domains:

<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to 3rd sub-domain of domain.com" stopProcessing="true">
<match url="^([^/]+)/(.*)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^(w([w-]*w)*).(w([w-]*w)*).(w([w-]*w)*).(domain.ir|domain.com)/?" ignoreCase="true" />
</conditions>
<action type="Redirect" url="http://domain.com/{C:5}/{C:3}/{C:1}/{R:2}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>


However, it doesn't work too.

Now, I want to ask how can I do that?

I think that even if I can't do it by the regular/ordinary way, I can do that by writing correct URL Redirect Rules. Of course, this may be wrong, and it's only an idea.



Checking Created Sub-domains:

Furthermore, I tested the created sub-domains via Ping command at the Microsoft Windows Command Prompt. Their results are as follows:



Figure 13 - Results of checking created sub-domains via Ping command at the Microsoft Windows Command Prompt



Full Summary of Hosting Space Features:

For offering more information about My Hosting Space Features, I've added a Full summary and you can see it in below:



Figure 14 - Full Summary of Hosting Space Features



My Host Provider Descriptions for Adding Sub-domains:

For more information, I've added descriptions of the adding sub-domains that have been provided by my host provider. I'm doing this, because I know that in most cases for solving these issues is necessary to know the applied logics and methods by the host provider; since the pages exist in the Persian language, I've translated the Essential Parts of them about my subject to English language.

How to create a sub-domain by entering the URL rewrite code in the web.config file:

Since creating sub-domain via WSP Control Panel (CP) in the P6 and above host plans causes wasting of your plan resources, each sub-domain is considered as a Hosted Domain. Therefore, you can use Virtual Sub-domains (that is supported by URL Rewrite feature in IIS 7 and later) in your plan for prevent this and also take advantage of the sub-domains.

To create a sub-domain follow the below steps:


Creating a Pointer for desired sub-domain:

Its descriptions are similar to what I mentioned before to add pointers for one-level sub-domains.
Creating a Folder with the same name of the desired sub-domain in wwwroot Folder via File Manager of the related site:

Its descriptions are similar to what I mentioned before to create the folder(s) for one-level sub-domains.
Adding related Codes to the site web.config file:

Please note that in all below code lines, must put Your Domain Name instead of domain.com.


























Note: If you have the Domain Alias in your hosting space and intend that defined sub-domain works for Successor Domain(s), you must perform the following levels:

Please note that must enter Your Main Domain Name instead of domain.com and your Successor Domain Name instead of domain.ir.

<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 3" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^www.domain.ir" negate="true" />
<add input="{HTTP_HOST}" pattern="^([^.]+).domain.ir" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="/{C:3}/{R:3}" />
</rule>
<rule name="Imported Rule 4" stopProcessing="true">
<match url="^([^/]+)/(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{THE_REQUEST}" pattern="^[A-Z]{3,9} /(.+) HTTP/" ignoreCase="false" />
</conditions>
<action type="Redirect" url="http://{R:3}.domain.ir/{R:4}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>



It should be noted to run .NET Applications in Virtual Sub-domains, after doing all above-mentioned cases, at the end, must define a Virtual Directory with the same name of that folder for the folder related to your Virtual Sub-domain.


How to create a sub-domain via Remote IIS:

Since creating sub-domain via WSP Control Panel (CP) in the P6 and above host plans causes wasting of your plan resources, each sub-domain is considered as a Hosted Domain. Therefore, you can use Virtual Sub-domains (that is supported by URL Rewrite feature in IIS 7 and later) in your plan for prevent this and also take advantage of the sub-domains.

To create a sub-domain follow the below steps:


Creating a Pointer for desired sub-domain:

Its descriptions are similar to what I mentioned before to add pointers for one-level sub-domains.
Creating a Folder with the same name of the desired sub-domain in wwwroot Folder via File Manager of the related site:

Its descriptions are similar to what I mentioned before to create the folder(s) for one-level sub-domains.
Writing related Codes to Redirect:

Please note that in all below code lines, must put Your Domain Name instead of domain.com, and save them in a file with txt extension under any name in Your Local System.

# Rewrite subdomain requests to subdirectories except for domain.com
RewriteEngine On

RewriteCond %{HTTP_HOST} !^www.domain.com [NC]

RewriteCond %{HTTP_HOST} ^([^.]+).domain.com

RewriteRule (.*) /%1/ [L]

#

# Redirect direct user-agent requests for domain.com/<subdomain>/<page> to <subdomain>.domain.com/<page>
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /(.+) HTTP/

RewriteRule ^([^/]+)/(.*)$ .domain.com/ [R=301,L]
Adding related Codes in the URL Rewrite through Remote IIS Manager:

First, connect to your site IIS.

After completing full connection to IIS Manager of your site, Import the saved txt file in the previous step (3) via URL Rewrite section of the IIS Manager.



It should be noted to run .NET Applications in Virtual Sub-domains, after doing all above-mentioned cases, at the end, must define a Virtual Directory with the same name of that folder for the folder related to your Virtual Sub-domain.


Wildcard DNS -> Creating a sub-domain by programming:


Getting Dedicated IP:

First, you will need to a Dedicated IP for implementation until refers the requests will send for each sub-domain of your site to the root of the related site. Furthermore, you can get SSL Certificate for it.
DNS Settings:

After getting Dedicated IP, you must edit Wildcard Record (*) in the "DNS zone records" of your host for your gotten Dedicated IP. With this, each sub-domain (if doesn't exist physically) will be referred to the Dedicated IP.
Adding related Codes:

If have written your application with version 3.5 of the ASP.NET or later, you can use ASP.NET Routing capability, and if ASP.NET version is lower than 3.5, you can use HTTP Handler.

For more information, a sample code is provided in below:

string host, originalurl, newurl;
host = Request.Url.Host;
originalurl = Request.Url.PathAndQuery;
if (host.EndsWith(".YourDomain.com"))
{
newurl = "Default.aspx?subdomain=" + host.Replace(".YourDomain.com", " ");
HttpContext.Current.RewritePath(newurl);
}

This codes descriptions as follows:

First, the requested address (URL) will be checked; if this URL be a Sub-domain of the Main Domain, the codes in the "if condition" is executed. After ensuring to sub-domain existing, name of that domain is redirected to a page. This is done by Rewrite the URL, and the end-user will not notice the transition. These instructions are written in the Application_BeginRequest Event (that is the first event that occurs after the end-user request). Note that you can create a Global.asax file for convenience and write codes in it.


"There is no subdomain here." error:

If you were faced with the "There is no subdomain here." message when viewing your site, check the following factors to fix the error:


The Suspension of Service (Suspend): [Passed]

The hosting service is suspended for several reasons as follows:


Confirmation: [Passed]


Incomplete Identification and/or Financial (Bill of Sale) Documents; to fix this problem, send the Required Documents by E-mail and/or Fax.


Disk space: [Passed]


Overusing of the Allocated Space on the plan; This space includes Space for E-mail and Website (FTP).

First, go to the "Space Quotas" page by clicking on Your Plan Name and check the Reports or go to the "Space Resource Quotas" page.

If you go to the Reports' section ("Hosting Space Disk Space Details" and/or "Hosting Space Bandwidth Details") or "Hosting Space Summary Information," you can see the Amount of the Occupied Space by your Files, Emails and Databases and etc.

Log in via FTP to reduce your Website Space. Then, proceed for Backing up and Downloading Files and reducing the size. To reduce the Amount of Occupied Space by the Emails, must proceed for Backing up via Microsoft Outlook software.


Database: [Passed]


In a **Shared Hosting, 10% of the Host Space is devoted to the Databases.** For example, if the host space be 500 MB, the allocated space to the Databases will be 50 MB. If your database type be Microsoft SQL Server (MS SQL Server), with Truncating the Logs and Shrinking the Database, the generated logs will be deleted and will dramatically reduce the size of the database. In addition, you can reduce the size of the database with Minimizing the Size of Logs; for this purpose, must select "Simple" option for "Recovery Model." And if you use MySQL Database, you can only Upgrade Your Plan to avoid suspension in facing with increasing the size of the database.


Bandwidth: [Passed]


Overusing of the Bandwidth causes to suspend the service too. Upload and Download via FTP, Displaying the Site for Visitors and Downloading E-mails are examples that cause to use the Bandwidth. To fix the suspension, wait until Excessive Using Period finishes or proceed to Upgrade Your Plan.


AUP (Acceptable Use Policy) Violations: [Passed]


In case of Infringement from Data Center Rules, the company will suspend desired services. Performing Phishing Illegal Operations and/or Running Fraudulent Site, Having Malware, proceed to Insert Another Company's Logo on your site and/or proceed to Perform Brute-force on the SSH are the items of Infringement from Data Center Rules. To resolve suspension, you must Contact with the Company Support Unit.
Removing the Domain: [Passed]

Not creating Domain in the Host CP or removing it causes to such an error.
Not Creating a Website: [Passed]

If you have defined a Domain in the Host CP, but haven't done anything to build a Website, "There is no subdomain here." message will be displayed.
Stopping Website: [Passed]

If stop the Website in the Website Settings' section, a similar error message will be displayed.



Thank you in advance.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Vandalay111

2 Comments

Sorted by latest first Latest Oldest Best

 

@Pope3001725

The approach of using a wildcard DNS record is probably the correct one for your use case.

When you configure a wildcard DNS record, all requests to any subdomain will be resolved to the IP address of your webserver. You can then further process the request on your webserver.

This approach is known as Virtual Hosting. Your webserver will decide which virtual website to direct the request to, based on the HOST HTTP header sent by the client (this header contains the host name the client used when they made the request).

In IIS, you'll find an option to specify the host name when you create a new web site. This is the hostname by which the site is identified. IIS will then automatically direct requests for that hostname to the site you configured.

10% popularity Vote Up Vote Down


 

@Odierno851

The software 'WebsitePanel' does not allow you to make subdomains of a subdomain.


You could use a sub-domain to create a new web site, but you cannot create another sub-domain based on it.


From www.websitepanel.net/documentation/users-guide/domains/#ManagingSub-Domains

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme