3

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?

5
  • Do you perhaps have a redirect in your web page?
    – mellamokb
    May 13, 2011 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, 2011 at 22:11
  • Is your domain registered somewhere else?
    – mellamokb
    May 13, 2011 at 22:20
  • yes, at 123cheapdomains.com but the subdomains are set up on my fasthosts account
    – David
    May 13, 2011 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, 2012 at 6:59

1 Answer 1

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.