Using .htaccess to set custom 404 page

404 file not found

Do you want to set a custom 404 page for your website on a Linux server. This is the best and quickest method to do it.

404 file not found

Download the .htaccess file from the root of your website. If you are downloading it to Windows’s OS the “.” will disappear and you have to rename it again to start file name with “.”.

Use following if you don’t have the website Template. It will print on browser for 404 request.

Page not found click here to continue

ErrorDocument 404 "<H1>Page not found <a href='.'>click here to continue</a></H1>"

If you have the website template create a new page and use it in 404 redirection. e.g we used file name file-not-found.php here.

ErrorDocument 404 /file-not-found.php

Don’t miss the forward slash before file name. else it will print file-not-found.php on 404 page request.

Some interesting message

“Page not found.”
“Sorry, we can’t find the page you were looking for.”
“Oops! Something is broken”
“Oh dear, this link isn’t working.”

Download free Image by Draguth Leon from Pixabay

1 Comment

  1. Pingback: .htaccess force SSL redirect of TLD or Subdomain - CertificationsKart.com

Leave a Reply

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