WordPress Error 404 and how to resolve it?

website-design-and-development-sydney-nsw

Recently updated on November 17th, 2023 at 04:00 pm

If you are a person who has been using the internet for a while then you must be familiar with this error. It is one of most annoying errors of WWW and it is caused when the requested address/typed site/link is broken or missing. It means that if you are a site manager and you have changed the address of a page then the person who types the old address will see the 404 Error or a simple misspelling of address will also display the same error.

How is it displayed?

The 404 error by default will leave the viewer with a blank white page displaying an error message, leading the viewer to type another address in most of cases.

How to resolve it?

The 404 error could be your mistake if you had changed the address of a page and didn’t update the old links properly or it can also be the user’s mistake if they had written the web address incorrectly. Not to fear, it can be corrected by providing alternatives. Many websites have customised their 404 errors into opportunities as “when the viewer cannot find one thing he’s searching for, best option is to give him another thing to have a look at.” This is done by simply customising the 404 error page into a page offering several interesting things or providing a search feature on the 404 error page. The modified 404 error page provides the visitor with a redirection to (anywhere you like) and helps in getting better Search Engine ranking as pages with broken links are ranked lower.

WordPress and the 404 Error:

WordPress is a world’s biggest self-hosted blogging tool with more than 66 million hostings. WordPress provides tools to modify the 404 error, which are discussed below.

WordPress themes provide by default error message file which is used when the 404-error occurs. The file is named as 404.php but it only displays the normal “404 error” which is not very user friendly. In order to create a meaningful 404 error page, you will have to edit the page as following:

Open the WordPress admin panel and click the appearance menu, then choose the Theme editor Page and look for the 404 template file and edit it. You can write the following as an example:

The first and easy way is to redirect the person to your homepage which can be done by writing inside the editor as,

<?php
header(“status: moved Permanently”);
header(“location: “.get_bloginfo(‘url’));
?>

The second is easy too if you want to redirect your viewers to any other page write the following and instead of aaa write your desired URL
<?php
header(“status: 302 moved permanently”);
header(“Location: http://www.aaa.com/aaa”);
?>

These two are simple solutions which solve 404 error problem and let your visitors stay longer on your website pages.

Best way to Avoid the Error 404:

The best way to avoid 404 Error is to create the site error free. There should be proper management and records should be kept regarding the links, their expiration and their redirection. The site should be properly updated and permalink’s should be made such a way that their removal/modification isn’t required for long time down the track.

Also Read: How to Optimise your Website for Bing

Latest articles