Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

In the DNS I have setup multiple URLs for my website (all pointing to same server). The entries in DNS looks like as below:

Host TTL Numeric IP

www .mysite.net 7200 192.168.31.12

@ (None) .mysite.net 7200 192.168.31.12

mycompany .mysite.net 7200 192.168.31.12

I wrote a code on Login.aspx page to check the URL and navigate to appropriate company login page. So if I type www.mysite.net or mysite.net then I am getting navigated to standard login page. But when I type mycompany.mysite.net still I am getting navigated to standard login page. But when I type https://mycompany.mysite.net then I am getting navigated to company specific login page. Why I need to type complete URL with https to get navigated to compay specific login page? Why it is not working just with mycompany.mysite.net? Any help of this is highly appriciated.

Thanks, Amit

share|improve this question
    
Can you provide some information about your server setup? Type of http server? Does the https instance have the same docroot/etc as the http instance? –  micah Apr 21 '10 at 17:36
    
We are using IIS 6.0 and installed wildcard server certificates for SSL. Login.aspx is the default page for the site which checks the URL and based on that navigates to company specific login page withing the same virtual directory. Do let me know if you need any other information. –  Amit Apr 21 '10 at 17:46

2 Answers 2

The normal way to accomplish this is by letting your server software inspect the host headers and use the right website directory based on them. Search for IIS Host Header or Apache Virtual Host for more information on how to accomplish this.

Your current problem lies in your script which you didn't share, so we can't debug it, you should print out the two values you are comparing to see what's going wrong.

share|improve this answer
    
I am using IIS 6.0. I only have one web site and not two. Still do we need to configure IIS Host Header? –  Amit Apr 21 '10 at 18:05
    
Sorry for this somewhat late response as I haven't checked ServerFault since... Look, if you want your code to handle showing the login page then this question should be moved to StackOverflow, in the other case you could solve this by multiple web sites for each login page and thus configure the Host Headers. A singe web page doesn't necessarily need host headers. –  Tom Wijsman Apr 28 '10 at 12:59

Generally the HTTP server will handle this so you don't have to write the code to do this. It is called virtual hosts, and in particular, in this case, name based virtual hosts.

share|improve this answer
    
Hi, Can you please give me some more information on this? I am got bit stuck on this. I am using IIS 6.0. –  Amit Apr 22 '10 at 21:15

Your Answer

 
discard

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