Skip to main content

How to Set Up a Custom 404 Page with .htacess

A 404 is an error message that is shown when the client browser sends a request to the web server for a file that is not present on the server. 404 error message means the client can successfully communicate with the server but could not find the requested file on the server. This message can distract the users from successfully browsing the site and most of the users end up closing the website. Hence, it becomes important to create a 404 custom error page in order to help the users to navigate across other suitable options present on the site.

404 Error Page (Image credit:- lava360)

A 404 error may display any of the following options:-

Sorry, the page you were looking for in this blog does not exist.

Sorry. The page you’re looking for seems to have gone missing.

Whoops... This page can't be found etc.

A nice solution to this problem is setting up a custom 404 error page with the help of .htaccess file. Firstly, you need to create a custom 404 page which you want to display to your users. Then proceed by following the steps given below:-


1- Search for .htacess file on the root of your web server. If you are able to find the file then follow step 3 else follow step 2.

2- Open notepad and save the file as .htaccess.

3- Add the following line in it (without changing the existing contents):-

ErrorDocument 404 /yourcustomerrorpage.php


ErrorDocument 404 /yourcustomerrorpage.html

where "yourcustomerrorpage" is the name of the custom page which you want to show instead of the error message.

4- Upload the file on the root of the web server.

Also See:- 

New Crawl Error Alert Feature in Google Webmasters
Types of Crawl Errors
Broken Links
Rich Snippets in Google
Google Knowledge Graph
Google Search Tips and Tricks
Stop Words in Seo