404 Page Not Found error is one of the most common errors faced by visitors to any website on the internet. There could be many reasons for the error such as broken links, mistyped urls or the previously hosted page being deleted from the website.
In this article, we are going to show how you can redirect your 404 pages to the homepage of your WordPress website.
What is a 404 error?
404 is an HTTP page not found error code which indicates that the requested page cannot be found on the server. 404 error pages can lead to loss in traffic and increase in bounce rates. These can affect the SEO score of your website negatively.
The best way to retain the traffic is to redirect them to the homepage of your WordPress website where they can find other relevant or interesting topics and stay engaged with the website. The two most common methods to redirect 404 error pages to homepage is with the help of a plugin or using htaccess file.
Redirecting 404 to homepage with the help of a plugin
We can easily redirect a 404 error page to the WordPress homepage with the help of Redirect 404 to Homepage plugin. The plugin has 20,000+ active installations and a 5 star rating on the WordPress plugins store.
The plugin uses 301 redirect which helps with passing the SEO score to your homepage. The plugin is also completely ad free.
Redirecting 404 pages is as easy as just installing and activating the Redirect 404 to Homepage plugin.
Once the plugin has been activated all your 404 error pages will be redirected to the homepage of your WordPress website.
Redirecting 404 to homepage using htaccess file
If you don’t want to install a plugin then you can also redirect 404 pages to the homepage with the help of htaccess file. Follow the below steps for redirecting the 404 pages:
- Using a ftp client or the hosting file manager visit the root folder of your website’s server files. Find the .htaccess file and open it with a file editor.
- Add the below line of code to the file and save it.
ErrorDocument 404 /
- You will now have to restart the apache server to apply the changes. Open the terminal of your server and enter the below code.
sudo service apache2 restart
- All the 404 error pages should now be redirected to the homepage of your WordPress website.