Fix 404 error | 404 file or directory not found error in WordPress

In terms of search engine optimization broken links are a crucial problem that may impact your organic search engine ranking as well as it will also affect your visitors user interface, and so fixing those broken links by redirecting broken 404 links to a custom designed page is the perfect solution for this problem. Creating a custom well-designed page in your WordPress blog is not a messy job, read this complete post and learn to fix 404 file or directory not found error in WordPress.

404 error


What is 404 Error

The 404 error simply means that the URL you are trying to reach is either deleted, or its URL is modified. It is a visitor side error which means either the page is permanently removed, or the URL parameter you typed into the address bar is incorrect. In simple words 404 not found error means,  the specific page that you are trying to reach is unavailable.

Whenever someone types a broken link, a web server sends back an HTTP code of 404 to indicate that a page is not found, and the default 404 page provided by your hosting may not provide any useful information that may result in losing your visitor. So, let’s learn how we can design an SEO optimized custom 404 not found error page.

How to fix 404 file or directory not found error

fix 404 error and design a SEO Optimized Custom 404 not found error page

Create a custom well designed 404 page from Pages > Add New, make the title as 404 error, as well as change its URL to ( If you have installed WordPress SEO by Yost Set Meta Robot index to noindex from Advance Tab because I don’t think you want any search engine to index your 404-page in the search results.

Next step is to edit the 404.php page, go to Appearance > Editor and click on 404.php page which is included by most of the themes but if you don’t find the the page simple add a new 404.php page from your control panel.

You will see some default PHP and HTML codes provided by your theme , backup and delete those default codes and insert the PHP code provided below.


Now, any 404 error or broken link will redirect to your custom well designed page where you can guide your audience to see your latest post or to see your top posts.

Here, in my blog I am currently showing my 10 latest post in the 404 page by using the amr shortcode any widget plugin due to which I can insert any widget inside the page or post. 

If you have access to your cPanel, then you can design your own SEO optimized custom 404 not found error page. A good 404 error page help your visitor to find the information they are looking for as well as it will also encourage them to explore your site further. A 404 page can also be a standard HTML page. Therefore, you can also customize it in any way you want. So, guys follow the tips to engage your visitor on the site and guide them to find the information they are looking for.

How to Deal with 404 page

Usually, 404 page doesn’t impact the ranking of your website, and you are free to ignore them. Generally, they are generated due to typing mistake, misconfigurations (links automatically created by CMS) or by the increased effort of the search engine to recognize and crawl the links in embedded content such as JavaScript.

Here are some of the steps that you should take to deal and investigate 404 errors.

  •  Find the source of invalid links by viewing the URL and by clicking on it. Just explore the pages of your blog and find out the source of 404 links.
  • After finding any 404 links just delete it or fix it from your website.
  • Some website may link back to your site, however sometimes may be due to typing mistake they may provide a wrong misspelled links. For example a misspelling of legitimate URL ( instead of ( probably happens when someone try to link to your site and simply made a typing mistake. You can capture those misspelled URL’s and by changing in your server configuration, you can redirect it to a correct page. Moreover, you can also contact the website owner to modify the link or to delete it.

Custom 404 not found error page must contain these qualities

While designing a custom 404 not found error page remember these points and create your page accordingly.

i. The Page Must Be Clear

Be clear and explain your visitors that the site they are searching for is either deleted, or it may not exist in the website. Never write 2 line of word saying that “Page Not Found” or avoid showing such pages that I have mentioned above in the figure. To be clear just design a custom 404 page because the default 404 page provided by your web server is useless and meaningless. Such 404 pages never guide your visitor to explore your site further. Therefore always design custom 404 page with friendly and inviting language that politely explains them about the non-existence of that page.

custom 404 error page

ii. Maintain same look

Look of your 404 page matters a lot in terms of visitors psychology therefore while designing a 404 page always keep in mind that the design and look should be same as the rest of your site including navigation. Never create a 404 not found error page that looks different from your website theme including your navigation, widgets, and the logo.

iii. Add links to popular Posts

A well designed 404 error page must contain the links to the most popular and the most commented post. By adding the links to those popular post, it will encourage your visitors to click on those link as well as it will also help the search engine to determine the popular links of your website.

iv. Provide a way to report a broken link

How about adding a simple form in 404 page for your visitors to report the broken links. You cannot find all of the broken links of your website just by researching of your own however when you add a simple form for your visitor then they can notify you about the link that is broken. It is a technique followed by some of the most popular blogs and Google also recommends this technique.

v. Never Index 404 page in Search Engine

It doesn’t matter how beautifully you have designed your custom 404 error page, always be sure that your 404 page never appears in Google search result. This is one of the worst case scenarios that may occur knowingly or unknowingly, therefore, to prevent custom 404 page from being indexed by search engine, make sure that your web server returns an actual 404 HTTP status code when a missing page is requested.

These are the steps that should be taken while designing your custom 404 page for your blog or a website. I hope this post will probably help you while designing a well-optimized custom 404 not found error page. Therefore, guys if you have any suggestion regarding 404 pages, please comment below to share your opinion.

Use this simple trick and design your custom 404 page to fix 404 file or directory not found error. I hope this post will you to fix the 404 error, and all I want is your precious suggestion in the comment below. Do comment below and share some other valuable tips that may help other newbies to establish a successful blog or a website.

I make $400 a Month from this Blog.
If you are interested on learning how I am earning $400-$500 a month sign up now to receive updates.

Add Your Comment

Pin It on Pinterest

Share This