Redirection

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Haris_P
Forum Newbie
Posts: 2
Joined: Wed Nov 05, 2003 2:58 pm

Redirection

Post by Haris_P »

I am running my own server on my older computer. What I was thinking was, how would I go about if lets say the primary server gives a 404 error, to automatically go to a backup server.

So if my server at home was down, it automatically goes to another on.

Any help would be much appreciated.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Well, not sure how to reroute a non-existant server, but using .htaccess for 404 errors (page not found):

Code: Select all

ErrorDocument 404 /error-docs/404.php
...and that page could contain a single header('Location: http://example.com/'); line used to forward the visitor.

You however ask "if your server is down"... Without the server, no error handling is available...
Haris_P
Forum Newbie
Posts: 2
Joined: Wed Nov 05, 2003 2:58 pm

Post by Haris_P »

Yea that's what I thought too. But I'll keep on searching to see if there's any other way.

By the way, why does my php page load slower than html, even though it has only html content on it, but just the extension is .php?
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

unless u use a DNS service somewhere else(not in your computer, or the computer that is handling the web pages), like dns2go, it will check if the IP or URL can be reached through the port 80 and if not it will show another page saying that or it will redirect somewhere else

tecnically, your own server, if it's down, cannot receive requests, same thing if someone comes to your house and you are not there, you cannot say hi to them, unless you leave a note or a nice neighbor to tell the person(in that case you would be using a DNS)

u can have a computer that works at DNS where you have your other comp, but this one should always be ON, so this can work
Post Reply