Howdy readers, Have you added a custom 404 page on your website? I know your answer will be ‘no’. No need to worry at all. Today in this article I will tell you how can you set up a custom 404 error page for your website. The process looks tough to set up but it is not the case as you think. This is just a 4 step process.
We will see it how this can be done easily using .htaccess file. You might know there is .htaccess file in your website root folder. We will just edit them to fulfil our purpose.
Some of you might hesitate to look into your .htaccess, In that case, you can contact your hosting provider or you can just drop me a mail at firstname.lastname@example.org. I will do the set up for you.
Here is the list of hosting providers which I recommend to my blog readers, clients and YouTube Subscribers.
|Sr No.||Hosting Provider||Direct Link|
|1||Interserver (Everything Unlimited)||Check Offers|
|7||Digital Ocean||Check Offers|
|8||a2 Hosting||Check Offers|
Why a 404 page not found error occurs on a Website?
Have you ever thought what will happen when you share your blog link to somebody with a spelling mistake? Which page will open when they open the shared link.? What if you visitor search something on your site which is not there? What pages will you show them at the moment?
So, we can take this in a scenario
Scenario 1 – Visitor looks for page on your website which is not thereThey will get 404 Page Not found Error Page
Scenario 2 – When a user tries to open a broken link of yoursThe user will get 404 Page Not found Error Page
Scenario 3 – When somebody tries to open a incorrect URLThey will get 404 Page Not found Error Page
Scenario 4 – When somebody search a wrong product on your websiteSorry, but nothing matched your search terms. Please try again with some different keywords.
Looking at the above scenario you can imagine how cringeworthy it would feel when they found an empty page with ‘404
This is the prime reason for writing this post. I hate “the page you are looking is not existed” like errors. This will help you to create and set up a custom 404 Error page for your website.
How to create a Custom 404 Error Page on your website?
There are some simple steps which you need to follow to set up a custom 404 error page. Let’s have a look at that.
1. Create a custom 404 page
This is the first thing you need to do if you want to set up a custom 404 page for your website or blog. You have a create a page which you want to use for 404 error page. For this, you can use page builders like beaver builder or Elementor.
If you know Html, CSS or PHP very well then you can develop a custom 404 error page by itself.
If you are looking for somebody to develop a custom 404 page for yourself then you can contact me at email@example.com
Let’s suppose you have created a custom error page named page-not-found.html. I will use this page later in this article.
2. Look for .htaccess file in your root directory
You can easily find a .htaccess file in your root directory. A root directory is normally a public.html folder inside File Manage in cPanel.
So, to access your root directory. Follow these simple steps –
- Open cPanel (https:domainname.com/cpanel)
- Login to Cpanel
- Navigate to File Manager
- Open the public.html folder in case of single website hosting or open the relevant folder in case of multi-site hosting.
- Look for the .htaccess file
- If you can’t find the .htaccess file. You need to turn on the hidden files option. To enable it, follow the steps given below.
- If there are no .htaccesss then create a file in the root directory and name it as .htaccess.
Sometimes it will happen that the .htaccess files will not appear in your root directory. In this case you need to turn on hidden files settings in cPanel. To turn it on follow the steps provided below.
- Login to your website cPanel
- Navigate to File Manager
- You can easily find a settings icon on the top right corner. Click on that
- Now find the Show Hidden Files (dotfiles) option and check it
- Click on Save button
- Now you can easily find the .
htacces sfile inside your root directory
3. Finally Editing the .htaccess file to setup the custom 404 page
This is the final step. After performing this you can take a power nap. As you would have performed an important task which is beneficial for your website in many aspects. I will try to describe it later.
So, now to finish the custom 404 error page set up, edit your website .htaccess file and write the codes given below at the last.
ErrorDocument 404 /page-not-found.html
Here /page-not-found.html is the full path to the new custom 404 page that you’ve created in step 1.
With this line, we’re sending guidelines to the server that in case of 404 error scenario, return this file to the browser.
You are done with the settings here.
4. Test your custom 404 page set up
To test it try to look for a page that does not exist on your website. You should get your custom 404
Or, simply search for an incorrect URL of your website. This should return the custom 404
Benefits of creating a custom 404 page
benefits of a custom 404 page depends on person to person. yet, i am defining some of them to open your mind about this.
- You can increase your pageviews just by adding some good post links on custom 404 error page
- You can increase the number of sales by adding some product on your newly created custom 404 page
- Even you can use custom 404 pages as a lead generation page
- You can use this page a vote page to know more about your visitor’s interest
- Promote your videos and products through this page
- A custom 404 error page will help you to reduce bounce rate and increase website engagements which is beneficial for website SEO and SERPs ranking.
What you shouldn’t do with 404 pages?
- Never redirect 404 errors to your home page. That’s confusing to your visitors. They have clicked a link thinking they’d get to their relevant content and you are sending them to irrelevant content with no explanation.
- Redirect 404 errors to another web site. Augh! Why do people even think? Is that’s OK?!
- Never send 404 errors to a Flash page.
- Send 404 errors to a page with a registration form that has 25 fields. I’m not making this up…Lol, What do you think people are a fool out there?
The story and the flow of your website will not be completed if you lead your website visitor to a dead end like 404. There are so many creative examples for you to get inspired from.
So, create a simple and interesting custom 404 page for your website and enjoy
If you have any query or suggestions feel free to comment below.
Thanks for reading.
Have a good day!
Read Next – How to add a custom featured Image in Blogger?