Cable Forum

Cable Forum (https://www.cableforum.uk/board/index.php)
-   General IT Discussion (https://www.cableforum.uk/board/forumdisplay.php?f=19)
-   -   checking if a site is up and running and if not redirect (https://www.cableforum.uk/board/showthread.php?t=33646376)

funkyCable 26-02-2009 11:20

checking if a site is up and running and if not redirect
 
Hi,

I'm setting up a laptop at home to be a webserver but want I wanted to know is whether I could have my domain name point to my blueyonder site which will just state that my server is down for the moment and to try again later. If the server is up then my domain should point to my laptop.


Any ideas if this is possible and if so how do I go about it?

Pushkar 26-02-2009 13:45

Re: checking if a site is up and running and if not redirect
 
Quote:

Originally Posted by funkyCable (Post 34740794)
Hi,

I'm setting up a laptop at home to be a webserver but want I wanted to know is whether I could have my domain name point to my blueyonder site which will just state that my server is down for the moment and to try again later. If the server is up then my domain should point to my laptop.


Any ideas if this is possible and if so how do I go about it?

Bit confusing but do you want:

When your server (aka home laptop) is running then it should point to that

But when your server (aka home laptop) is turned off, then it should say try later?

If so, it's possible but I just don't know how to do it!

funkyCable 26-02-2009 14:17

Re: checking if a site is up and running and if not redirect
 
Thats bang on.

Horace 26-02-2009 14:31

Re: checking if a site is up and running and if not redirect
 
I assume you're using some kind of dynamic address system such as dyndns since giving out IP's is messy. If so they have an offline redirect which would accomplish what you're suggesting. You'll need to look into the site since I'm a free user and I can't see an option for it but I know it's available on pay accounts.

funkyCable 26-02-2009 14:34

Re: checking if a site is up and running and if not redirect
 
I am using dyndns as a free user as well. I have my domain setup with 1-2-3reg.co.uk

Yeowser 26-02-2009 18:18

Re: checking if a site is up and running and if not redirect
 
I would suggest you leave your domain pointing to the blueyonder space and script that particular page to check on the status of you personally hosted site to forward/present error as required.

KingDaveRa 26-02-2009 19:21

Re: checking if a site is up and running and if not redirect
 
I doubt the BY webspace supports any sort of 'clever' scripting, i.e. PHP. Possibly perl though.

If it did, you could potentially have it do a quick connection on port 80 to see if your site was up, and then send a redirect header to redirect the page. It'd actually only be a few lines of PHP to implement. But it's reliant on the PHP being there.

TBH, get a proper web host.

funkyCable 26-02-2009 20:53

Re: checking if a site is up and running and if not redirect
 
having a look at the BY webspace help http://www.virginmedia.com/customers...space-help.php and it seems to support PHP, perl etc.

Could anybody here help me with it? I just got the basics of php

KingDaveRa 27-02-2009 16:12

Re: checking if a site is up and running and if not redirect
 
Holy crap, Python too! Ex-BY customers only though.

Here in php we have:

PHP Code:

<?php
// Try to open a socket to the server at home on port 80
$fp fsockopen("myhomesever.dyndns.net"80$errno$errstr10);
if (!
$fp) {
    
// Site is down, so we give an error - probably a PHP error too. This could be better!
    
echo "The site is down.";
    
} else {
    
// Site is up, so redirect to it
    
header('Location:http://myhomeserver.dyndns.net');
    
fclose($fp);
}
?>

Quick and dirty starter for 10.

Caspar 27-02-2009 21:27

Re: checking if a site is up and running and if not redirect
 
You could use zoneedit.com - supports failover DNS, take a look.


All times are GMT +1. The time now is 01:01.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum