Last Updated: February 25, 2016
·
604
· ivex

How to do a personalisable error on your Website

Configure Apache

Create a .htaccess in the root folder of your website

Then, edit it, and add those lines :

This is activating the Rewrite Module of Apache, can be uncommented in httpd.conf

RewriteEngine On
Options -MultiViews

That line is changing the directory of the 404 error

ErrorDocument 404 /404

Can also be :
"ErrorDocument 500 /500"

The last line change the adress "http://website.com/404.php" in "http://website.com/404", you can also use this for your index.

RewriteRule ^404$ 404.php [L] 

Then, create a 404.php

And edit it :

<?php include 'includes/header'; //Include your header ?>
    <div class="erreur">
        <img src="images/404.png">
        <a href="index.php"><img src="images/lien.png"></a>
    </div>
 <?php include 'includes/footer.php'; ?>

So you got a fabulous 404 error with some photos, CSS, etc...

Picture