Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a ASP.net website e.g. www.website.com. The idea is that you will go to the URL 'yourname.website.com' and my site will request the name from the sub domain, process it and change the content accordingly.

I purchased my Fasthosts hosting package and created a sub domain which points to a folder on my web hosting package at Fast Hosts. e.g. www.website.com/folder.

However when I now go to the URL yourname.website.com it is immediately redirected to website.com/folder. This means I cannot request the sub domain from the URL because it has been lost.

I have tried contacting these guys but they don't understand and keep going on about some sort of redirect script (although I don't see how any further redirects can solve my problem).

Is there something I am missing here?

share|improve this question

migrated from stackoverflow.com May 15 '11 at 7:04

This question came from our site for professional and enthusiast programmers.

    
Do you perhaps have a redirect in your web page? –  mellamokb May 13 '11 at 21:52
    
no, the problem is, when i go to my subdomain url, fasthosts redirect it to the subfolder and the url changes. this means i cannot use the subdomain in the url. i don't know much about domains and subdomains so im not sure if this is supposed to happen or if what i want is impossible whilst using fasthosts –  David May 13 '11 at 22:11
    
Is your domain registered somewhere else? –  mellamokb May 13 '11 at 22:20
    
yes, at 123cheapdomains.com but the subdomains are set up on my fasthosts account –  David May 13 '11 at 22:25
    
If it helps I have a zend framework application. Each user gets their own sub-domain when they register. There is one application folder. So when a visitor goes to username.example.com they see the login screen. For connections to sub-domains I have a wild card A record to the application server IP. For www and non-www I have other A records. Our application checks if the sub-domain exists when a user connects if yes it renders the login from the root folder. If no they get a custom 404 page. Check your file and folder paths are correct in your ASP.NET application. –  Anagio Mar 11 '12 at 6:59
add comment

1 Answer 1

I think if I understand the question correctly, you currently have a website setup (www.website.com) that is currently an ASP.Net application. When a user enters 'subdomain.website.com' you want the exact same website to respond, but within the code of the application some function/features/content/etc. would be changed based on that particular subdomain?

It sounds like all you need is for a CNAME DNS record to be created and then the host header for that subdomain added to your website. Your application would then handle the rest. A subdomain is typically a separate website. Many control panels will create a folder and then associate that folder as the document root of the site (essentially creating a separate IIS website for the subdomain that points to the subfolder). In your case, it sounds like the document roots are being set something like this:

IIS site 1 = www.website.com: document root = (some-filesystem-path)\webroot

IIS site 2 = subdomain.website.com: document root = (some-filesystem-path)\webroot\subdomain

What you really want to have happen is to only have a single IIS website with multiple host headers. It may be that you just need to setup an alias rather than a subdomain in your control panel.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.