When managing an eCommerce website built on Magento, it’s common to encounter 404 errors. These errors occur when a user tries to access a page that doesn’t exist, which can harm your site’s user experience and SEO rankings. The good news is that Magento allows you to handle these 404 errors efficiently by redirecting users to valid URLs. In this article, we’ll explore how to redirect 404 URLs in Magento, and provide easy-to-follow examples from the admin panel.
What is a 404 Error?
A 404 error occurs when a user tries to access a web page that the server can’t find. This could happen for various reasons:
- The product or page was deleted.
- The URL structure has changed.
- The user mistyped the URL.
When visitors land on a 404 page, they might leave the site, resulting in a higher bounce rate. Therefore, redirecting these broken links to relevant pages is crucial for a smooth user experience.
Why Redirect 404 URLs in Magento?
Redirecting 404 URLs has several benefits:
- Improve User Experience: Users are taken to a relevant page instead of a dead end.
- Boost SEO: Search engines may penalize websites with too many 404 errors, affecting your rankings. Redirecting these pages can improve your SEO health.
- Retain Traffic: Visitors who land on a valid page are more likely to stay on your site and explore other products or services.
Types of Redirects in Magento
Before we dive into the steps, it’s important to understand the two main types of redirects you can use:
- 301 Redirect (Permanent): This tells search engines that the page has been moved permanently. It is the most commonly used redirect and transfers the SEO value from the old URL to the new one.
- 302 Redirect (Temporary): This indicates that the page has been temporarily moved. SEO value is not transferred in this case.
For handling 404 URLs, a 301 redirect is usually the best option because it passes on the SEO benefits to the new page.
How to Set Up URL Redirects for 404 Pages in Magento (Step-by-Step)
In Magento, you can manage redirects directly from the admin panel without needing to edit any code. Here’s how to do it:
Step 1: Log into Magento Admin Panel
- Go to your Magento store’s admin URL.
- Enter your login credentials to access the admin dashboard.
Step 2: Navigate to the URL Rewrite Tool
Once you’re logged into the admin panel:
- From the left sidebar, navigate to Marketing.
- Under the SEO & Search section, click on URL Rewrites.
This tool allows you to create, edit, and manage all URL redirects in Magento.
Step 3: Create a New Redirect
To create a new redirect:
- Click on the Add URL Rewrite button in the top right corner.
- You will be prompted to select a redirect type. Choose Custom.
Step 4: Set Up the URL Redirect
In this step, you will set up the actual redirect.
- Request Path: This is the old, broken URL that is generating the 404 error (e.g.,
old-page.html
). - Target Path: This is the new URL where you want to redirect users (e.g.,
new-page.html
). - Redirect Type: Choose 301 Permanent Redirect.
Example:
If you deleted a product page like /outdated-product.html
and want to redirect it to a newer product page /latest-product.html
, here’s what you’ll enter:
- Request Path:
outdated-product.html
- Target Path:
latest-product.html
- Redirect Type:
301
Step 5: Save the Redirect
Once you’ve entered all the necessary information:
- Click on the Save button.
- Magento will now redirect all traffic from the old URL to the new one, ensuring users don’t encounter a 404 error.
Bulk Redirects for Multiple 404 URLs
Sometimes, you may need to redirect multiple 404 URLs at once. Instead of adding redirects manually one by one, you can use an extension or module that supports bulk URL redirects. Here’s how you can do that:
Step 1: Install a URL Redirect Extension
You can find various Magento extensions that support bulk URL redirects on the Magento Marketplace or third-party providers. Some popular ones include:
- MageWorx SEO Suite
- Amasty URL Rewrites Manager
- Redirect Manager by FMEextensions
Step 2: Upload the Redirects via CSV
After installing the extension:
- Navigate to the extension’s settings page in the admin panel.
- You will have the option to import redirects using a CSV file.
The CSV file typically contains two columns:
- Request Path: The old, broken URL.
- Target Path: The new URL where you want to redirect users.
Example of CSV Format:
Request Path | Target Path |
---|---|
old-page-1.html | new-page-1.html |
old-category.html | new-category.html |
Once the file is uploaded, the extension will create all the necessary 301 redirects, saving you a lot of time.
Managing 404 Errors with Google Search Console
While Magento’s built-in tools allow you to redirect URLs, you also need to find out which URLs are generating 404 errors. One of the best ways to monitor 404 errors is by using Google Search Console.
Step 1: Log into Google Search Console
- Go to Google Search Console and log in using your Google account.
- Select the website for which you want to check 404 errors.
Step 2: Check the Coverage Report
In the Search Console dashboard:
- Navigate to Coverage on the left-hand menu.
- Here, you will find a list of errors, including any 404 pages Google has detected.
Step 3: Identify the 404 URLs
In the Coverage report, you can filter the results to show only Not Found (404) errors. Once you have this list, note down the URLs that need redirection.
Step 4: Create Redirects for These URLs in Magento
Go back to the Magento admin panel and follow the earlier steps to create URL redirects for each 404 error detected in Google Search Console.
Best Practices for Redirecting 404 URLs in Magento
- Monitor 404 Errors Regularly: Regularly check your Google Search Console and other analytics tools for 404 errors. Don’t wait until users complain.
- Use 301 Redirects: Always use 301 redirects for permanent changes. This ensures search engines pass the SEO value from the old URL to the new one.
- Redirect to Relevant Pages: If a product is discontinued, redirect users to a related product or category, not just the homepage. This helps retain user interest.
- Test Your Redirects: After setting up redirects, test them to make sure they are working properly. Simply enter the old URL in your browser and see if it takes you to the new URL.
- Avoid Redirect Chains: Too many redirects in a chain can slow down your website and harm SEO. Ensure that each old URL redirects directly to the new one.
Conclusion: The Importance of Redirecting 404 URLs
404 errors can negatively affect both user experience and SEO rankings. In Magento, you have powerful tools at your disposal to manage and redirect these broken URLs effectively. By following the steps outlined in this article, you can ensure that your visitors never hit a dead end, keeping them engaged with your website and improving your SEO in the process.
Proper management of 404 errors through URL redirects is not only good for your users but also vital for maintaining a healthy, SEO-friendly Magento store.