A 404 error is what happens when you try to access a page on a website that doesn’t exist. We’ve all gotten them; due to typos, a moved file, whatever the case. As designers / developers we need to make sure we help the users of our websites should this happen to them. The last thing we want is for them to get an ugly 404 error, get discouraged, and exit your website.
Instead, you want to create a custom 404 webpage, and redirect the user to this page should the error happen to them. This is done by uploading a .htaccess page to the root of your website.
Simply create a text document named htaccess in any text editor, and copy past the following code.
ErrorDocument 404 /404.html
What that code is doing is redirecting the user to 404.html. Obviously you can name the page anything, just make sure to change the code. Upload the file, put a dot in font of the name ( so it’s .htaccess ), and you’re all set. Go to your site and type in a page that you know doesn’t exist. You should be re-directed to your new 404.html page.
Speaking of your new 404.html page, make sure when you create it you help the user along. You can do whatever you want, just make sure you are making your user’s life easier.
Here is a htaccess file you can download and use.