/    Sign up×
Community /Pin to ProfileBookmark

Display latest stabile version

Is there a (easy) way to detect errors on a page, ex: /index.php and then, instead of “trying” to wiew index.php redirect to /last_stabile_index.html???

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogDec 20.2006 — Not sure if this is what you mean, but you could do the following:
[code=php]
<?php
ob_start(); // so that header redirect will be sure to work
function my_error($errCode, $errString)
{
header("Location: http://www.yoursite.com/last_stable_index.html?errno=$errCode");
}
set_error_handler("my_error");
// rest of page.....
[/code]

See the [url=http://www.php.net/set_error_handler]set_error_handler page[/url] for more info, including the types of errors which will not be handled.
Copy linkTweet thisAlerts:
@alxlaauthorDec 20.2006 — Ok

I s'pose that i'll have to put something in $errCode and $errString, but what? I've just started with php, and all this functions driving me nuts ?
×

Success!

Help @alxla spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...