How To Resolve a 404 Error: Page Not Found in Magento 2

404 errors occur in all online stores

And that’s OK.

New pages are added, old pages are removed. However, things can go south when the number of 404 errors becomes very high.

First of all, although 404 errors do not directly impact a store's ranking on SERP, they pull from an already-limited crawl budget (Crawl Budget) which means they bring you unnecessary losses.

Secondly, just the appearance of a 404 error can negatively influence customers’ impressions.

Imagine this situation: a random user visits your store and is presented with a 404 error page. He or she does not obtain the required content and starts to doubt whether your store page is actually worth browsing. In most cases, he or she does not keep searching for information on your store and definitely does not make a purchase.

Why do 404 errors occur?

In the overwhelming majority of cases, the reason for a 404 error is a change in products or categories URL Keys.

Also, it often happens that a store includes into its functional an extension for URL structure changing (for example, Layered Navigation with friendly URLs). Needless to say, this type of extension update or removal can lead to a 404 error.

And last but not least is the following reason for error: a store was migrated to Magento 2 from another e-commerce platform (Prestashop, Shopify, Drupal, WooCommerce, etc) or from Magento 1. In this case, the search systems contain thousands (if not millions) of pages with old URLs, and when trying to re-index, end up obtaining a 404 error in response.

How do 404 error pages influence the business?

Back in 2011, Google answered some questions about the 404 error pages on their blog. The existence of these pages themself is not damaging to the score of the website. Search engines don't lower the ranking of it if they notice a 404 error page not found. So, should you just let them go cause they are no threat to the SEO? No, you should. Not found pages may cause no damage to the SEO, but they still are bad to have on any website.

The answer lies in the realm of UX, or User Experience. Statistics say that over 80% of users will never return to a website that gave them a bad time. Stumbling across 404 pages is not pleasant. It's like hitting a dead end and needing to start a content search all over again. Visitors do not tolerate such mistakes. Moreover, damaged backlinks can lessen the traffic.

Speaking shortly: 404 error pages are generally not great for any business because of poor UX and broken website structure.

How to get a list of pages with a 404 error

We considered possible reasons, but before we start looking for a solution, we must obtain a full list of your store 404 pages. This is possible in the following ways:

Get 404 pages from Google Search Console

Just open Google Search Console and visit the page Crawl > Crawl Errors > Not Found

404 Pages from Google Search Console

Get 404 pages from Google Analytics

In Google Analytics, it is required to use the parameter “404” and filter the list of all your store pages, as is represented on the screenshot :

404 Pages from Google Analytics

Why is it important?

The main reason is simple – you may not know if they are present otherwise. As was said above, these pages are caused not only by deleting old content. Adding new modules or migrating to another platform can cause it. You may lose popular pages with flowing traffic and don't even know it. Important pages with high traffic should be found and restored. Also, by closely watching the statistics regarding 404-page activity, you can determine what events cause their appearance.

How to resolve 404 errors

Well, you have a full list of 404 error pages and now you have to redirect users to new, relevant pages. There are several options available to solve this task:

  • To set redirects for all pages manually
  • To redirect a user to the search page

How to create 301 redirect

If you use Advanced SEO Suite, you can redirect users from a 404 page to a new page by simply going to Marketing > Advanced SEO Suite > Redirects and adding a redirect there:

Advanced SEO Suite - 404 Redirects

Also, you can import a .csv file with all the required redirects, using the inbuilt import option.

However, the main disadvantage of this approach is the necessity to create a list with coinciding old and new pages. If you have more than 1000 pages - it is much faster to set a redirect to the search page, which will ensure that you cover all 404 pages.

Pages that are best to redirect to

There are enough options for custom redirects from website error 404, but what are the best ones? There are three effective choices:

  • Landing. An option that never gets old – redirect users to the landing or main page. Not the most pleasant solution, but a simple and comprehensible one. It has a reasonable chance to hook users back in, especially if the page is well-designed.
  • Product list or search page. The visitor will not get his desired content but won't be removed from the search process. And if he already knew what he was here for – this option serves as an inviting crossroad for a different query.
  • FAQ. If users don’t land on the desired page, they will have questions. Why not address them immediately by sending users to an FAQ section of your website?

How to redirect 404 pages to search

This opportunity is available in our Sphinx Search Ultimate and Elastic Search Ultimate extensions for Magento 2. To enable the option, simply go to the extension settings Store / Configuration / Mirasvit Extensions / Search and activate the 404 to Search option.

Now the search will automatically display relevant results for all 404 pages in accordance with the requested URL.

Search Results for 404 Page

Is the design of 404 pages important?

Many companies have special designs for 404 error pages. Users are greeted by funny robots, cute bears, or other mascots and kindly sent to a relevant page. Businesses do this to improve user comfort and make potential customers feel cared about. Sure, you can redirect people from 404 pages. But wouldn't that be nice if before that they would see a pleasant message?

So, even if you set up redirects, it is still useful to customize your error message pages. Magento 2 extensions can help you with that. They can give you the right tools to create unique designs and draw a little chuckle from a user who stumbled upon a nonexistent page.

How to force a 404 error page make money

The answer is simple – customize them to be entertaining or promoting. In the first case, you can build trust and boost interest by making an error 404 page engaging. Write trivia there and add art. This way, instead of broken pages, you will have more content for your users. In the second case, you may add an advertisement to a 404 page. Search engines won't be interested, but your users might be. So how can you do it?

Standard Magento solution

Basic Magento 2 tools can be used to customize the 404 page. The entire process will be done through an admin panel. Open it, go to the Content menu, and then to Pages. You will see a list of all pages that make up your website. Use the search bar in the top-left and type in proper keywords, like “404”, to find the needed page. Then, you just select the “Edit” option in the drop-down menu on the right. The page’s content may be rewritten in HTML and CSS.

Can you remove the URL on your store to resolve the 404 error?

Short answer – no. It is important to choose the right way how to fix 404 error. While you technically can put content somewhere else or delete it entirely, it would not resolve the problem. Say some other website referred to you in their blog or article. If you place the same content under another URL, that link will still be broken. Third-party websites probably won't update it. Moreover, even internal linking can be destroyed by rash changes.


404 errors are a routine presence in online stores. It is normal and, in a sense, natural. In addition, it is quite costly and problematic to seek to completely avoid them. However, if you know how to use the redirect option correctly, you can support users’ interest, even if they visit a page with a 404 error. You may also customize 404 pages to make them less stressful to see. Funny messages and cute mascots boost the trust of the users.

Oleksandr Drok

Head of Products at Mirasvit

Alex serves as the Head of Products at Mirasvit, where he formulates the vision for Mirasvit's extensions, carefully curates new features, and constructs the roadmap.
Related Products
Advanced SEO Suite M2

From meta tags to the sitemap, the Magento 2 SEO Extension gives you full control over each and every SEO-related feature in your store.

This extension is a SEO powerhouse that provides major enhancements to all pages of any online shop.

This amazing package will save you an incredible amount of time and money, all while securing your site's place at the top of the search results!

Keep Learning