Trang chủ Technical SEO for Magento Magento URL rewrite: Complete Guide to Setup and Optimization

Magento URL rewrite: Complete Guide to Setup and Optimization

bởi Magento SEO knowledge hub
7 lượt xem

Magento URL rewrite is an essential SEO mechanism in Magento 2 that helps transform complex system-generated links into clean, optimized, and user-friendly URLs. In this guide, we break down how Magento 2 URL rewrites work, why they are crucial for search performance, and how you can configure, manage, and troubleshoot them effectively. Whether updating product URLs or redirecting old paths, this article provides all the best practices to maintain a well-structured and SEO-ready store.

Magento URL Rewrite: The definition and purposes

A Magento URL rewrite is a feature that allows store owners and developers to customize or change the URLs of products, categories, or other pages in their Magento store. Instead of relying on the system-generated URLs, which can often be long, complex, or not SEO-friendly, URL rewrites let you create clean, readable, and user-friendly URLs.

For example, instead of a product URL like:

https://www.example.com/catalog/product/view/id/1234

You can have a cleaner version:

https://www.example.com/blue-leather-handbag

The main purposes of Magento URL rewrites are:

  • Improving readability: Short and descriptive URLs are easier for customers to remember and share.
  • Enhancing SEO: Search engines favor URLs that contain relevant keywords and are structured logically.
  • Maintaining backward compatibility: URL rewrites allow you to redirect old URLs to new ones without losing traffic or search ranking.
  • Customizing store structure: You can create URLs that match marketing campaigns, seasonal promotions, or brand guidelines.

How to Configure Magento 2 URL Rewrite Index?

How to Create and Manage URL Rewrites in Magento 2

Magento 2 provides a robust URL rewrite system that lets you customize, manage, and optimize URLs for products, categories, and custom pages. Proper URL management improves SEO, user experience, and prevents errors like 404 issues or duplicate content.

Creating URL Rewrites via Admin Panel (Step-by-Step)

Manually creating URL rewrites is ideal for individual products, categories, or specific CMS pages. Here’s the detailed workflow:

1. Log in to the Admin Panel

  • Use your admin credentials to access the backend.
  • Navigate to URL Rewrite Management > Marketing > SEO & Search > URL Rewrites

 This grid displays all existing URL rewrites for your store.

2. Add a New URL Rewrite

  • Click Add URL Rewrite.
  • Choose the type:

    • For Product – rewrite a product URL
    • For Category – rewrite a category URL
    • Custom – rewrite a CMS page, landing page, or create a unique path

3. Configure the Rewrite

  • Request Path: This is the URL visible to users (e.g., mens-leather-jacket). Keep it concise and keyword-rich.
  • Target Path: Enter the system-generated path (e.g., catalog/product/view/id/101). Magento will redirect the request path to this target.
  • Redirect Type:

    • No Redirect – replaces the old URL without redirecting
    • Temporary (302) – useful for short-term campaigns
    • Permanent (301) – recommended for SEO when replacing or consolidating URLs
  • Store View: Apply the rewrite to specific store views if you have a multi-store setup.

4. Save and Test: Click Save. Always test the new URL on the frontend to ensure it works correctly and the redirect functions as expected.

Pro Tip: Avoid special characters or capital letters in request paths—they can create SEO or browser issues.

Editing and Deleting Existing Rewrites

Magento allows you to modify or remove URL rewrites if needed. This is important when products are renamed, categories restructured, or URLs need SEO optimization.

1. Access the URL Rewrite Grid > Marketing > SEO & Search > URL Rewrites

  • Search or Filter: Use filters like Request Path, Target Path, Type, or Redirect Type to quickly locate specific rewrites.

2. Editing a Rewrite

  • Click the rewrite to open the edit form.
  • Update the Request Path or Target Path.
  • Change the Redirect Type if required.
  • Save your changes and test the URL on the frontend.

3. Deleting a Rewrite

  • Select one or multiple rewrites using checkboxes.
  • Click Delete and confirm.

Pro Tip: Before deleting rewrites, check whether the URL is linked from external sites or used in marketing campaigns. If yes, set up a 301 redirect to preserve traffic and SEO value.

Bulk Management Using Import/Export or Extensions

For stores with hundreds or thousands of products, manual management is inefficient. Magento 2 supports bulk operations via import/export and third-party tools:

  1. Using Magento Import/Export
  • Go to System > Data Transfer > Export.
  • Select URL Rewrites as the entity type.
  • Export the CSV file to edit URLs in bulk (add, update, or delete).
  • Re-import the CSV to update the store.

Example: You can replace spaces in URLs with hyphens or append campaign tags to multiple products in one batch.

2. Using Extensions for Bulk Management

    • Many Magento 2 extensions simplify URL rewrite tasks for large catalogs.
    • Key features include:

      • Bulk creation of 301 or 302 redirects
      • Conflict detection for duplicate URLs
      • Auto-generation of SEO-friendly URLs based on product/category names
      • Integration with external CSV files or databases

Pro Tip: Schedule periodic audits of URL rewrites to ensure there are no broken links, unnecessary duplicates, or outdated redirects. This practice keeps your Magento store SEO-friendly and avoids negative impacts on user experience.

Common URL Rewrite Issues and How to Fix Them

While Magento 2’s URL rewrite system is powerful, improper configuration or changes can lead to common issues that affect user experience and SEO. Understanding these problems and knowing how to fix them is essential for store owners.

404 Pages After URL Changes

A 404 error occurs when a page cannot be found at the requested URL. This often happens after:

  • Renaming a product or category
  • Changing URL keys without creating a redirect
  • Deleting URL rewrites accidentally

How To Create a Custom 404 Page With Your Own Design?

How to fix:

  1. Set up 301 redirects: Always redirect old URLs to new ones using Magento’s URL rewrite system.
  2. Check the URL rewrite grid: Go to Marketing > SEO & Search > URL Rewrites to verify that the old URL exists or has a redirect.
  3. Clear cache: After changes, flush Magento cache to ensure updates are visible on the frontend.

Pro Tip: Use Google Search Console or an SEO tool to identify 404 errors on your site regularly.

Duplicate URL Keys

Duplicate URL keys occur when two or more products or categories have the same URL key. This can lead to:

  • Search engine indexing issues
  • Conflicts in URL rewrite resolution
  • Confused users who may land on the wrong page

How to fix:

  1. Identify duplicates: Use the URL rewrite grid or run a database query on the url_rewrite table.
  2. Rename the URL key: Ensure each product, category, or page has a unique, descriptive key.
  3. Redirect old URLs: Use 301 redirects if the original URLs have external links or rankings.

Pro Tip: Magento automatically appends a number to duplicate URL keys if a conflict is detected, but manual checks are recommended for large catalogs.

Redirect Loops and Conflicts

Redirect loops happen when a URL points to another URL that eventually redirects back to the original. This can crash pages and confuse search engines. Conflicts occur when multiple rewrites point to the same target URL.

How to fix:

  1. Check existing rewrites: Look for overlapping or conflicting URL rewrites in Marketing > SEO & Search > URL Rewrites.
  2. Avoid multiple redirects: Only set a single 301 redirect per old URL.
  3. Use proper hierarchy: When rewriting categories and products, ensure rewrites respect the store hierarchy to prevent loops.

Pro Tip: Test redirects using browser dev tools or SEO crawlers to detect potential loops before they affect users or search rankings.

Tips for Troubleshooting

  1. Enable Developer Mode: This helps identify URL rewrite issues in real-time and shows detailed error messages.
  2. Check the url_rewrite table in the database: This table contains all rewrites. Use queries to detect conflicts, missing redirects, or duplicates.
  3. Audit after migrations or imports: URL issues often appear after bulk product imports or platform migrations.
  4. Flush caches regularly: Changes may not appear until caches are cleared, including Magento cache, Varnish, or CDN caches.
  5. Use SEO and link audit tools: Tools like Screaming Frog, Ahrefs, or Google Search Console can identify 404s, duplicates, or redirect loops efficiently.

Pro Tip: Maintain a consistent URL structure policy for your store (e.g., hyphens instead of underscores, lowercase letters) to prevent common errors and simplify troubleshooting.

SEO Best Practices for Magento URL Rewrites

Properly configured URL rewrites not only improve usability but also boost your store’s SEO performance. Following best practices ensures your URLs are search-engine friendly, easy for customers to read, and free from conflicts.

Using Keywords in URLs

Incorporating relevant keywords in URLs helps search engines understand the page content and improves rankings for targeted terms.

Best practices:

  • Use primary keywords that reflect the product, category, or content of the page.
  • Keep URLs short and descriptive. Avoid unnecessary words, numbers, or special characters.
  • Separate words with hyphens () rather than underscores (_).
  • Ensure URLs are lowercase to avoid duplicate content issues.

Example:

  • Poor URL: https://www.example.com/catalog/product/view/id/1234
  • SEO-friendly URL: https://www.example.com/blue-leather-handbag

Pro Tip: Include location-specific keywords for local SEO if applicable (e.g., mens-jackets-hanoi).

Implementing 301 Redirects for Old URLs

Whenever a URL changes—whether due to renaming products, restructuring categories, or marketing campaigns—implement 301 redirects to preserve SEO value.

Why 301 redirects matter:

  • Redirects pass most of the original page’s link equity to the new URL
  • They prevent 404 errors, improving user experience and search engine indexing.

Best practices:

  • Always use 301 Permanent Redirects for replaced or deleted URLs.
  • Avoid chaining multiple redirects, as this can dilute SEO value and slow page loading.
  • Track redirects in a spreadsheet or database to manage large catalogs efficiently.

Pro Tip: Test redirects after implementation using browser tools or SEO crawlers to ensure they point correctly to the target page.

Avoiding Unnecessary URL Rewrite Clutter

Over time, Magento stores can accumulate redundant or unused URL rewrites, which may:

  • Slow down the URL rewrite system
  • Cause conflicts or redirect issues
  • Confuse search engines and users

How to prevent clutter:

  • Periodically audit URL rewrites in Marketing > SEO & Search > URL Rewrites.
  • Delete outdated, unused, or conflicting rewrites.
  • Use bulk management tools or extensions for large catalogs to clean up efficiently.

Pro Tip: Keep a consistent naming convention for URL keys across products and categories to reduce unnecessary duplicates.

Looking to take your Magento store’s SEO to the next level? Optimizing your URLs is a crucial step for improving search engine rankings, enhancing user experience, and avoiding common URL rewrite issues. For a detailed, step-by-step guide with actionable strategies, check out our comprehensive article: 10 Tips to Optimize Magento URL for SEO and start making your store URLs cleaner, more SEO-friendly, and easier for your customers to navigate today.

FAQs about Magento URL rewrite

  1. Can I create a URL category rewrite for a subcategory in Magento 2?
    Yes, you can create URL rewrites for specific subcategories via the Admin Panel by navigating to Marketing > SEO & Search > URL Rewrites, clicking “Add URL Rewrite”, and selecting the “For Category” option.
  2. What should I consider when choosing a new URL for a category?
    The new URL key should be descriptive, include relevant keywords, consist of lowercase characters, and use hyphens to separate words. The Request Path (the new URL) must be unique for the specified store view to avoid errors.
  3. How can I manage and monitor the performance of my URL rewrites?
    URL rewrites are stored in the url_rewrite database table. You can manually inspect this table or use third-party extensions to export, audit, and manage rewrites in bulk. Monitoring performance often involves checking traffic via analytics and ensuring no 404 errors appear in your technical SEO reports.

Conclusion

Mastering Magento URL rewrite features is key to maintaining a clean site structure, improving crawlability, and strengthening overall SEO performance. By leveraging both automatic and manual rewrite tools, you can ensure consistent URLs, prevent broken links, and deliver a better user experience. With proper configuration and routine checks, Magento 2 URL rewrites become a powerful asset in long-term site optimization and search visibility.

Bạn ơi, bài viết hữu ích với bạn chứ?  
Đánh giá bài viết này

Bài viết liên quan

Hãy để lại bình luận của bạn