Setting 404 Error Page di 000webhost

pasti lu pernah kan kalao web yang lu buat dari 000webhost mengalamai Error 404 karena salah url atau salah ketik
dan web lu mendirect ke http://error404.000webhost.com/?
cara nya seperti ini :

1.Pertama adalah tambahkan atau edit file .htacces pada /public_html hosting kamu . Isikan file tersebut dengan kode berikut ini :

ErrorDocument 403 /error.php
ErrorDocument 404 /error.php
ErrorDocument 500 /error.php

 
2.Kemudian tambahkan juga file error.php pada /public_html hosting kamu. Isikan file tersebut dengan kode berikut ini

<?php
$status = $_SERVER['REDIRECT_STATUS'];
$codes = array(
        403 => array('403 Forbidden', 'The server has refused to fulfill your request.'),
        404 => array('404 Not Found', 'The document or file requested was not found.'),
        405 => array('405 Method Not Allowed', 'The method specified in the Request-Line is not allowed for the specified resource.'),
        408 => array('408 Request Timeout', 'Your browser failed to send a request in the time allowed by the server.'),
        500 => array('500 Internal Server Error', 'The request was unsuccessful due to an unexpected condition encountered by the server.'),
        502 => array('502 Bad Gateway', 'The server received an invalid response from the upstream server while trying to fulfill the request.'),
        504 => array('504 Gateway Timeout', 'The upstream server failed to send a request in the time allowed by the server.')
        );
$title = $codes[$status][0];
$message = $codes[$status][1];
if ($title == false || strlen($status) != 3) {
    $message = 'Please supply a valid status code.';
}
echo '<p><h1>' . $title . '</h1></p>' .
     '<p>' . $message . '</p>';
?>


tapi bisa juga error.php nya kita ganti dengan script kita sendiri...
ya tergantung kreativitas




0 komentar to "Setting 404 Error Page di 000webhost"

Posting Komentar

Laman

x0wn3d

nanda. Diberdayakan oleh Blogger.

About This Blog

My Blogs

Followers

Web hosting for webmasters