Implement the 404 Page
Now that you have your custom error page coded (referred to as 404.html from here on), Now quickly go to the home directory /var/www/html/.
The next step is editing your Apache localized-error-pages file to use 404.html instead of the default error page.
Locate your localized-error-pages configuration file in the/var/www/html/.directory. The file will be called localized-error-pages.conf
Now you can see there are different types of error pages that can be overridden. Just uncomment line 8 that starts with “ErrorDocument 404” and add “/404.html” instead of the default location for that error page. You can simply repeat this or create different custom error pages for each type of error.
Save and Exit Once Done
ErrorDocument 404 /404.html