We take pride in your success. We let our positivity drive us, day in and out. Talk to us at Mindfire to know us more.

Software Technology Tips

Sometimes while browsing sites on the web, you must have noticed that some links show errors like:

-          You don’t have permission to access the page.

-          The requested URL /test.php is not found on this server.

 Here is an example: http://phpnuke.org/test.php

Here it shows your server info and port. This is a server generated message. For each type of error, the server shows a static HTML page. 

However, to make your site more attractive you can create you own customized page and show it in your web application instead of showing the system generated message. Also you can redirect the user to the index page.

This can be handled by using .htaccess file. 

Steps:

  1. Create your own customized error pages for 404 or 403 or any other error type. You can create it with your own logo and content. 
  2. Create the .htaccess file in the root virtual directory and write the following code in the .htaccess file.

ErrorDocument 404 404.html

ErrorDocument 403 403.html

If you want to show your index page, if any of the 404 or 403 error occurs. Then write the following line in your htaccess file.

ErrorDocument 404 index.html

ErrorDocument 403 index.html

 

Here are some websites, those uses their own customized error page.

http://us.php.net/manual/en/test

http://php.resourceindex.com/test

Examples of server error code:

400 Bad Request

401 Unauthorized

402 Payment Required

403 Forbidden

404 Not Found

Reference for server error code: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html


Related Tags:

Web Development, .htaccess, Server Error, Redirection

Author: Supriti Panda

top

Web Development

Let us Connect!

privacy

copyright (c) Mindfire Solutions 2007-2012. Login