Today I will show you how to redirect all 404 errors to the Homepage in the blogger. 404 Error is very harmful to any site, especially for Google search engine and visitors. If you have these 404 errors on your site, fix them now.
I will show you that method, but first, you need to know how a 404 error is created. Because 404 errors are created by you, they can happen without your knowledge. If you know the reasons, don’t make those mistakes anymore.
How is a 404 error created on the site?
- Although there are many reasons, the main three are-
- If you delete a post or page,
- If you change the URL of a post or page,
- Adding a domain after the website is indexed in the search engine,
As you can see from the above reasons, errors are created by you. So don’t make these mistakes again, if you have already made a mistake then redirect 404 errors to the homepage of the site. If that redirection is automatic then very good, I will now show that redirection method-
how do Redirect all 404 errors to the Homepage Automatically?
First, download the code file by clicking the download button below. In that file, you will find an HTML code and a CSS code. The CSS code needs to be added to the theme but the HTML code is already in your theme, just need to replace it.
NOTE:- I always say before any change in the theme, you should definitely back up. So first of all take a backup of the theme, if any mistake is made then you can restore the site.
1. CSS CODE PLACEMENT:-
- Open the HTML code of your theme and find ]]></b:skin> ,
- Paste the CSS code before “]]>: skin>” and save the theme for the first time.
2. FIND ANY 404 PAGE:-
- First, visit a post or page of your site then you will get the link of the article, for example- https://yourdomainname.com/2020/22/post-name.html.
- Now delete any word of the post name in the URL and press enter. Then the 404 interfaces of your site will open, as you can see in the image below.
NOTE:- Now if your 404 page is automatically redirected to the homepage, then you know that your site already has this feature. Otherwise, follow the procedure below and activate 404 redirections.
In the two pictures above, you can see 404 interfaces of two types. There are differences in design between the two images but there is a similarity. That is, even if it is small, there must be a description or paragraph, you must have a 404 interface like this. Now follow the below steps-
3. HTML CODE PLACEMENT:-
- Copy some text from the paragraph of your 404 error interface,
- Now go to the theme and search the copied text, then you will get 404 HTML code. That code will look a bit like the code below.
- Remove all this code and paste my HTML code.
- Save the theme and visit your site 404 errors in this way.
4. HOW TO CHANG REDIRECTION DELAY TIME:-
See the image below to change how soon the 404 page will be redirected to the homepage.