How to Create a Magento 2 URL Category Rewrite?

How to Create a Magento 2 URL Category Rewrite?

Magento 2 Category URLs take customers to the desired product list on an e-commerce store. This tutorial explains the uses of URL rewrites and outlines the steps to create Magento 2 URL category rewrites.

Key Takeaways

  • Magento 2 URL category rewrites allow store owners to create custom, SEO-friendly URLs.

  • Creating intuitive and logical URL paths improves site navigation and customer understanding of the site's hierarchy.

  • Keyword-rich, clean URLs contribute to improved SEO and increased click-through rates (CTR).

  • URL rewrites are essential for managing site migrations and changes, preserving link equity, and avoiding 404 errors.

  • Magento 2's URL rewrite feature includes capabilities for custom campaign tracking and avoiding URL conflicts.

What are Magento 2 URLs

Magento 2 URLs are web addresses used to navigate and access different parts of a Magento e-commerce store. These URLs are essential for both users and search engines, as they lead to various content types within the store.


It includes product pages, category pages, CMS pages, and other functionalities like customer account pages and checkout processes. Understanding the structure and types of Magento URLs can help optimize an online store for better user experience and SEO.

Types of Magento URLs

  • Base URL: The base URL is the main URL of your Magento store, which is used as the starting point for all other URLs. It typically includes the domain name and possibly a subdirectory. For example, https://www.examplestore.com/.

  • Secure and Unsecure URLs: Magento allows you to specify both secure (HTTPS) and unsecure (HTTP) URLs for your store. It ensures that pages like checkout and customer account pages can be accessed securely.

  • Product URLs: These URLs lead directly to individual product pages. Magento allows for SEO-friendly product URLs, which can include the product name and other relevant keywords. For example, https://www.examplestore.com/category/subcategory/product-name.html.

  • Category URLs: Category URLs take users to specific category pages that list all products within that category. These URLs can be structured to include parent and subcategory names for better clarity and SEO. For example, https://www.examplestore.com/category/subcategory/.

  • CMS Page URLs: CMS pages are used for content like about us, terms and conditions, and privacy policy pages. The URLs for these pages can be customized in Magento to be descriptive and user-friendly. For example, https://www.examplestore.com/about-us.

  • Dynamic URLs: These are URLs that contain query strings and parameters, often used for filtering or search results within the store. They can look like https://www.examplestore.com/catalogsearch/result/?q=keyword.

What are Magento 2 URL Rewrites and Why Create Them?

Magento 2 URL Rewrite is a useful tool that enables store owners to create custom, SEO-friendly URLs for any page. It can replace the default dynamic or system-generated and allows you to change any URL associated with a product, category, or CMS page.


Creating URL rewrites in Magento 2 is a practice that serves several purposes, both from an SEO standpoint and a user experience perspective. Magento URL rewrites allow you to customize your store's URLs to be more readable, memorable, and search-engine friendly.

1. Improved SEO

  • Keyword-Rich URLs: Including relevant keywords in your URLs can help improve your site's SEO. Search engines like Google use the URL to understand the content of the page. A keyword-rich URL can contribute to better rankings.

  • Canonical URLs: URL rewrites help in managing canonical URLs for products and categories that can be accessed via multiple paths. It prevents duplicate content issues, which can negatively affect your SEO.

2. Enhanced User Experience

  • Memorable and Clean URLs: Users are more likely to remember and revisit clean and descriptive URLs. For example, a URL like /women/dresses/red-dresses is far more user-friendly than /catalog/product/view/id/123.

  • Easier Sharing: Clean URLs are more appealing and easier to share, both in digital communications and via word-of-mouth. They reduce confusion and increase the likelihood that the URL will be shared correctly.

3. Better Site Navigation

  • Intuitive Paths: URL rewrites allow for the creation of intuitive and logical paths through your website. It makes it easier for customers to navigate your site and understand where they are in your site's hierarchy.

  • Breadcrumb Navigation: Clean, rewritten URLs contribute to more accurate and helpful breadcrumb trails. It further enhances navigation and the user experience.

4. Increased Click-Through Rates (CTR)

  • More Attractive Links: URLs that are short and descriptive and include keywords are more likely to be clicked. It can lead to increased traffic and higher conversion rates through social media, emails, or search engine results pages.

5. Management of Site Migration and Changes

  • Redirects for Discontinued Products: When a product is discontinued, a URL rewrite can redirect users from the old product page to a related category or product. It improves the shopping experience and retains sales.

  • Site Re-structuring: If you decide to re-structure your site, URL rewrites ensure that links to your site remain functional. They redirect old URLs to new ones, preserving link equity and traffic.

6. Custom Campaign Tracking

  • Marketing and Promotional Efforts: URL rewrites can be used to create custom URLs for marketing campaigns. It makes it easier to track the performance of specific promotional activities through analytics tools.

7. Avoidance of URL Conflicts

  • Unique URLs for Similar Products: In Magento, products that have similar names across different categories can lead to URL conflicts. URL rewrites allow for custom paths that clearly distinguish between such products, avoiding potential confusion for search engines and users alike.

Step to Enable URL Rewrite In Magento 2

URL Rewrite is typically enabled by default in Magento 2, but if it’s not working or to confirm its status:

Step 1: Go to Admin Panel > STORES > Configuration

Step-by-step guide to enabling URL Rewrite in Magento 2 configuration settings

Step 2: In the left panel, expand General and select Web.

Navigating to the Search Engine Optimization section in Magento 2 for URL rewrites

Step 3: Expand the Search Engine Optimization section, set the value of “Use Web Server Rewrites” to “Yes,” and click the “Save Config” button.

Steps to Create Magento 2 URL Category Rewrite

Step 1: From the admin panel, go to Marketing > URL Rewrites.

Accessing URL Rewrites section in Magento 2 admin panel

Step 2: Click “Add URL Rewrite" to initiate a new rewrite.

Adding a new URL rewrite in Magento 2 through the admin interface

Step 3: Choose the “Type of Rewrite” as “Category” from the URL Rewrite dropdown.

Selecting the type of URL rewrite for category in Magento 2

Step 4: Select the appropriate “Store View” or select “All Store Views” to apply the rewrite universally.

Choosing the store view for a Magento 2 URL category rewrite

Step 5: Define the old (Request Path) and new (Target Path) URLs.

Defining request and target path URLs for Magento 2 category rewrite

Step 6: Choose a redirect type:

  • Permanent (301) for long-term changes

  • Temporary (302) for short-term adjustments

Choosing a redirect type for Magento 2 URL category rewrite

Step 7: Click Save.

Tips and Considerations

  • Testing: Always test your new URLs to ensure they work as expected and do not produce any 404 errors.

  • Avoid Conflicts: Make sure the new request path does not conflict with existing URLs. Magento will warn you if there’s a conflict.

  • Impact on SEO: When changing URLs, consider the SEO implications. Use 301 redirects to preserve search engine rankings when moving content to a new URL.

  • Maintenance: If you have a large number of rewrites, consider maintaining a spreadsheet to keep track of changes.

FAQs

1. What is a URL category rewrite in Magento 2, and why is it important?

A URL category rewrite in Magento 2 allows you to change the URL of a category page to something more user-friendly or SEO-optimized. It does so without altering the actual structure of your site. It is important to improve the usability of your site, making it easier for customers to remember and revisit certain pages. It also enhances your site’s visibility in search engine results.


2. Can I create a URL category rewrite for a subcategory in Magento 2?

You can create a URL rewrite for a subcategory just like you would for a primary category. Follow the same steps as creating a rewrite for a primary category, but ensure you select the correct subcategory. It allows for more detailed customization of your store’s navigation and improves the overall structure of your URLs.


3. What should I consider when choosing a new URL for a category?

When choosing a new URL for a category, consider using keywords that are relevant to the products in the category. Keep the URL concise and avoid using special characters or spaces. Use hyphens to separate words. It's also wise to ensure the new URL is not already being used elsewhere on your site to avoid conflicts.


4. How can I manage and monitor the performance of my URL rewrites?

Managing and monitoring the performance of your URL rewrites involves reviewing your site's analytics. Tools like Google Analytics can provide insights into page views, bounce rates, and other relevant metrics. Keeping an inventory of your URL rewrites in Magento 2 can help manage them more effectively. It allows you to revisit and adjust them as needed based on their performance.

Summary

Creating a Magento 2 category URL rewrite is about guiding customers through your digital storefront with ease and precision. This tutorial listed the benefits of URL rewrites and the steps to create them. Follow these steps to ensure your e-commerce store's URLs are not just pathways but powerful conduits of success:

  • Before finalizing any URL rewrite, rigorously test to ensure they do not trigger 404 errors.

  • Be vigilant to ensure that your newly crafted URLs do not clash with existing ones.

  • Opt for 301 redirects to maintain search engine rankings and guide users and crawlers to the new URLs.

  • Maintain a detailed spreadsheet to keep tabs on all changes, simplifying future revisions and audits.

Choose managed Magento hosting to obtain the maximum benefit from Magento 2’s URL rewrite tool.

Wishu Sindhu
Wishu Sindhu
Technical Writer

With over 15 years experience in the tech industry, Wishu excels in communicating various software concepts. Focusing on Magento, he has produced extensive documentation and tutorials, sharing Magento hosting expertise with audiences.


Get the fastest Magento Hosting! Get Started