Home > Blogs, Bookmarks, Hosting, PhP, Web > Custom 404 Error Page with htaccess

Custom 404 Error Page with htaccess

November 18th, 2007 Leave a comment Go to comments

Add the following line to the .htaccess file

ErrorDocument 404 /errors/404.php

ex .htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
ErrorDocument 404 /errors/404.php
</IfModule>

Upload 404.php file to /errors/ folder.

404.php can redirect to homepage, ex:
Redirection url with META Refresh:

<html>
<head>
<meta http-equiv=”refresh” content=”0;url=http://www.new-url.com“>
</head>
<body>
This page has moved to <a ref=”http://www.new-url.com“>http://www.new-url.com</a>
</body>
</html>

GoCache - ByREV-Cache v1.0 - live served in : 0.180156 sec (gzip)