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 exists on the server. As per the SEO perspective, its not good to return 404 error code to user even requested file doesn’t exit.
Now, You can either configure a custom 404 error page on your server or redirect website to 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 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 following content.
<h2>Page Not Found</h2>
<p>The Page you are looking for doesn't exist or moved to other location. Go to <a href="">Home Page.</a></p>
Next, create and edit .htaccess file under the document root of your application and add the following content to end of file.
#### Error Documents
ErrorDocument 404 /custom_404.html
Save file and close it.
Now, access any file to your domain, which doesn’t exist on server. You will see the custom error page instead of default Apache error message on your web browser.