Solved Redirect to second alternative site if main site is down

November 25, 2013 at 07:40:05
Specs: Windows 7
Good day...

I want to add a code on a page that filters whether thr primary site is down; if primary site is up, the home page will just show up as expected and nothing needs to be done, since the site is ok. If the primary site is not accesible, then the script will redirect to a second, identical, site in another server. The filtering script, of course, is to be placed in a blank page located in a third server, serving just as the entrance gateway for the checking.

I'd prefer a javascript alternative for this, though PHP is also acceptable.

Thanks !!

See More: Redirect to second alternative site if main site is down

Report •

November 25, 2013 at 07:52:38
And what happens if the third server goes down? You still have a single point of failure. The best way to cope with this is just two servers running clustering software. This not only provides redundancy but also improves performance

Report •

November 25, 2013 at 08:16:13
✔ Best Answer
Well, the possibility of a third one going down may exist, but the probability of the first one going down is certainly higher. This happens, obviously, when one needs to use free hosting, with the unstability and lack of support this may represent.

I only need an onerror function to trigger the checking sequence, doesn't have to be highly sophisticated. For example, in some pages I use something like this :

<img src=''
onerror='alert("Internet connection seems to be down.");' />

Something similar, but instead of creating an alert, redirecting the page to a second URL might work. And please, take note that I'm a novice as far as code is concerned.

Report •

November 25, 2013 at 08:43:50
If the third server is more reliable than the other two then I would use that one for the website.

Clustering is the standard way to provide redundancy if you have two servers available.

Report •

Related Solutions

November 25, 2013 at 09:03:09
I'd appreciate to be assisted proving a script with a simplicity as shown. That's all I'm asking.

There might be optimal ways to solve it, but for administrative, financial or site value reasons, a "checking then go or else" script would suffice.

Any other suggestions, please...

Report •

November 25, 2013 at 09:11:07
If you have access to the DNS server for your domain then another very simple solution is round robin DNS. Just have two entries with the same name pointing to the DNS addresses. This doesn't address the problem of keeping the servers in synchronization, which clustering would do, but it is more resilient - and easier - than your proposed solution.

Report •

Ask Question