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

I have one server, and two sitets -- let's say A and B.

The problem (for me) is when I shut down B site, when I try to browse:

www.b.com

instead of displaying an error, IIS redirects me (silently) to A, so in effect I get the addres:

www.a.com

So how to block this redirection (and display an error)?

IIS 7.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Your site bindings for www.a.com are most likely general enough that they catche www.a.com too. i.e. it's a binding by IP address, which is the same for both sites.

Matt's suggestion will work, to create a custom handler on www.a.com. You can also leave your www.b.com site up, with the binding for www.b.com, and point all traffic to an error page.

Or, you can update your DNS record for www.b.com to point to another server or location entirely.

share|improve this answer
    
Thank you, the IP is indeed the same. I cannot assume B is always on (because from time to time I turn it off) and I cannot change the DNS, because site B has to stay where it is now. So, from what I see I need to create another default site which purpose will be displaying error pages -- it would serve as fallback for shutting down A or B. –  greenoldman Sep 15 '10 at 7:47
    
Yes, that will work. The trick will be to make it so that you can't forget to turn the fallback site on. You mention that you're using IIS 7. Have you considered URL Rewrite? With URL Rewrite, you could add a rule to the www.a.com site to listen for all traffic where {HTTP_HOST} = www.b.com and throw a custom error page. Then when www.b.com is turned off, the URL Rewrite rule will kick in. That's similar to Matt's suggestion, so it's a matter of which method you prefer of catching and redirecting your site. –  Scott Forsyth - MVP Sep 15 '10 at 13:28

On your default site,

create a script that shows the error that you want. I had to do the same thing a while ago, because all .domain.tld sites were really just a virtual directory.

<?php
 $f = $_SERVER['server_name'];
 header("Location: http://offline.domain.tld/?q=".$f);
?>
share|improve this answer
    
Btw. inn my case each site has its own directory. So I should create additionaly another site (the default one) which purpose is just to show an error, right? If any of the sites, A or B, are down, the redirection will go to the default one. Did I understand you correctly? –  greenoldman Sep 14 '10 at 11:58

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.