404 error redirect to another page

change AllowOverride directive from none to All in all files:

/etc/apache2/sites-enabled/000-default
/etc/apache2/sites-available/default

then:

vim /var/www/.htaccess and add this line:

ErrorDocument 404 /404.php

where 404.php is a file created to redirect specially when encounter the 404 error!

my 404.php looks like this:




/* This will give an error. Note the output
* above, which is before the header() call */
header('Location: http://alinneaga.info/webmail/');
?>


ofcourse 404.php is in /var/www/

Comments