Tuesday, November 2, 2010

Customized 404 Not Found Page for your website

A 404 error is the response given by the web server when we try to open a page on the internet that does not exist.

If you don’t specifically tell your web server how to handle 404 errors, it will serve up a very plain and generic looking error page. That just says something like “Not Found – The requested URL was not found on this server.” on a plain white page.”

normal

A 404 page should look like an error page, but it should still look like your website. If you are using a CMS, this is probably already handled for you. If you have a static site, you can specify a 404 template through your .htaccess file.

- source http://css-tricks.com/


Here is how you make your custom 404 page :

Step 1:

Suppose your Web-project folder is xampp/htdocs/test

Create a new text document in your website’s folder.

Type the following inside the text file:

ErrorDocument 404 /test/error404.php

Save the file as .htaccess

Step 2:

Next create the error404.php page in the path specified above, i.e. in the test folder in this case.

This is the page which will be shown instead of the normal 404 error page.

Sometimes there might be some Webserver issues which can be rectified as follows :

A directive should be added to your httpd.conf for the directory which your website lives in. Let's say for this example it's /www/htdocs. Here's a line in your httpd.conf that you must have for this .htaccess file to work:

<Directory /www/htdocs/yoursite>
AllowOverride FileInfo
</Directory>

- source http://www.devarticles.com/

modified

Good read : http://css-tricks.com/404-best-practices/


Dedicated to X[a]T!, Os!r!S & KenSe! for their constant effort in reducing the load on Mother Earth.

Powered By Blogger
Custom Search