Free Android CakePHP GMaps Articles by Bali Web Design

September 8, 2008

How to redirect 404 to error page?

Filed under: website management — admin @ 11:33 pm

We need to give message to our website user that requesting a page that doesn’t exist in our website. If we don’t think about this or left it as default, user will get error message that produce by the browser. And this is not look professional.

So we need to give a message about what they looking is not exists in our website and give him option to search or go to another page. There are a simple way to do it, by add ErrorDocument info on htaccess file.

First create an error html file, named it as you want, for example 404-error-page.htm. And then edit htaccess file, put this line at last line.

ErrorDocument 404 /404-error-page.htm

Upload htaccess file again to your server. Later if someone looking for a page that doesnt exists in your website, server will redirect into 404-error-page.htm