URL rewrites
The URL rewrites tool lets you change any URL that is associated with a product, category, or CMS page. When you create a URL rewrite, Commerce automatically creates a permanent redirect (301) so that any links pointing to the old URL are redirected to the new address.
Understanding rewrites and redirects
The terms rewrite and redirect are often used interchangeably, but they are different operations:
-
URL Rewrite — A server-side process that internally maps one URL to another without changing what appears in the browser’s address bar. When a visitor requests a URL, the server processes it as a different URL behind the scenes, but the browser continues to display the original URL.
-
URL Redirect — Sends an HTTP response to the browser instructing it to navigate to a different URL. The browser’s address bar updates to show the new URL. Redirects can be temporary (302) or permanent (301).
How the Rewrites tool works
In Adobe Commerce, the URL rewrites tool creates permanent redirects (301) by default to preserve SEO value when you change the URL key of a product, category, or page. This behavior ensures that existing links continue to work and search engine rankings are maintained.
By default, automatic URL redirects are enabled for your store and the Create Permanent Redirect for old URL checkbox is selected under the URL key field of each product.
URL rewrites demo
Watch the following video to learn about managing URL rewrites:
Create URL rewrites
Use the URL rewrites tool to create product and category redirects, and custom redirects for any page in your store. When the URL rewrite configuration is applied, any existing links that point to the previous URL are seamlessly redirected to the new address.
You can create URL rewrites to:
-
Add high-value keywords to improve the way the product is indexed by search engines.
-
Add additional URLs for a temporary seasonal change, or permanent change.
-
Add a valid path for a page, including CMS content pages. For example, you can create a URL to create a more user- or SEO-friendly URL on a system that always references products and categories by their internal ID.
The URL rewrites you create can redirect to existing categories or custom pages without changing your site structure, making it easy to create memorable URLs for marketing campaigns.
Commerce offers these URL rewrite types:
Use cases and examples
URL rewrites are commonly used in these scenarios:
Change an internal system URL to an SEO-friendly URL
Commerce uses ID-based URLs internally, but you can create SEO-friendly URLs for customers:
System URL (internal):
http://www.example.com/catalog/category/id/6
Customer-facing URL:
http://www.example.com/peripherals/keyboard.html
Product rebranding or URL optimization
When you rename a product or want to improve its URL for SEO, create a redirect to preserve existing links:
Original URL:
http://www.example.com/peripherals/keyboard.html
New optimized URL:
http://www.example.com/ergonomic-keyboard.html
The Rewrites tool automatically creates a 301 redirect from the old URL to the new one, so customers and search engines are seamlessly directed to the correct page.
Promotional landing pages
Create temporary or permanent custom URLs for marketing campaigns:
Promotional URLs:
http://www.example.com/all-on-sale.html
http://www.example.com/save-now/spring-sale
Additional URL management configuration
The following sections describe how to configure Web Server Rewrites and canonical URLs for Commerce.
Configure Web Server Rewrites
index.php), while the URL Rewrite tool manages redirects for content changes.Enabling Web Server Rewrites is part of the initial Commerce setup and is typically configured during installation. When enabled, the web server (Apache or Nginx) automatically removes the file name index.php from URLs, creating cleaner, more SEO-friendly addresses.
The following example shows how URLs appear with and without web server rewrites enabled:
URL without a Web Server Rewrite
http://www.yourdomain.com/magento/index.php/storeview/url-identifier
URL with Web Server Rewrite
http://www.yourdomain.com/magento/storeview/url-identifier
Enable or disable Web Server Rewrites:
-
On the Admin sidebar, go to Stores > Settings > Configuration.
-
In the left panel where General is expanded, choose Web.
-
Expand
the Search Engine Optimization section.
{width="600" modal="regular"}
-
Set Use Web Server Rewrites to your preference.
-
When complete, click Save Config.
Specify canonical URLs
For SEO purposes, each of your web pages should have only one, distinct URL.
If you have a single page accessible by multiple URLs, or different pages with similar content, Google sees these as duplicate versions of the same page. Google chooses one URL as the canonical version and crawls that, and all other URLs are considered duplicate URLs and are crawled less often.
If you don’t explicitly tell Google which URL is canonical, it makes the choice for you, or might consider them both of equal weight. This could lead to unwanted behavior, and risks an ineffective crawl budget and low distributed backlinks.
Depending on how you set up your website, there may be multiple versions of your site in the index, for example:
https://www.example.com
https://www.example.com/
http://www.example.com
https://example.com
https://www.example.com/index.html
To specify a canonical page, see Google Search Central documentation.