Skip to content

Create A Custom 404 Error Page on Apache

Category
Web Servers
Covers
Apache

Apache Error code 404 means “file not found”. This is the error code when a user requested a web page or file which does not exist on the server. As per the SEO perspective, it’s not good to return a 404 error code to the user even requested file doesn’t exist.

Now, You can either configure a custom 404 error page on your server or redirect the website to the home page. In this tutorial, we will help you to create a custom 404 error page for your Apache server.

Create A Custom 404 Error Page

First of all, create a 404 file on your server. You can create this file under the document root of your application. For example, I have created a file named custom_404.html under the document root with the following content.

Next, create and edit the .htaccess file under the document root of your application and add the following content to the end of the file.

Save the file and close it.

Now, access any file to your domain, which doesn’t exist on the server. You will see the custom error page instead of the default Apache error message on your web browser.

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top