ESDS Knowledge Base


404 Error Pages: What are they and how to create them?

What is 404 Error Page & how to create?

404-error-pagesAll we have seen. You’re navigating a website and you click a link, but the page does not load other than a few words of “404” and some additional information.

So, what is a 404 page? It basically tells you that the server cannot find the website page you’re looking for. However, instead of using the 404 error page by default, you can create one. Here’s how it’s done.

First, you need your .htaccess file that should be in the directory of your Web server where you have hosted your pages. If you cannot find, you have to create one. You’ll probably have to contact your hosting support to ask them how to create it or edit it. You might want to use a text editor and then upload it to the server, or create and edit directly from the server tool they use.

Once you have the .htaccess file created and edited by adding a line like the following:

ErrorDocument 404

Now that the line in the .htaccess file points to the error page we create. This is just an HTML document. Once you’ve created, save it and call 404page.php or html as per url structure. The next step is to upload the .htaccess file to the server and the error page.

Once you are located in the corresponding directory we have to get it going. We do this by changing the attributes CHMOD to 644. You can do through a Telnet or FTP program of your choice. If you connect via Telnet and do it via command, you must type the following:

chmod 644 .htaccess

Now you must try if it works. Simply type your domain in the browser points to a page that does not exist, and you should see the 404 error page. If not, make sure the CHMOD is configured correctly, and if you still have problems, your Web hosting company can surely help you.

Leave a Reply