URL rewrites

The URL rewrite tool lets you change any URL that is associated with a product, category, or CMS page. When the rewrite goes into effect, any links that point to the previous URL are redirected to the new address.

To update URL rewrites for multiple or all products simultaneously, refer to Multiple URL rewrites.

The terms rewrite and redirect are often used interchangeably, but refer to slightly different processes. A URL rewrite changes the way that a URL appears in the browser. A URL redirect updates the URL that is stored on the server. A URL redirect can be either temporary or permanent. Your store uses URL rewrites and redirects to make it easy for you to change the URL key of a product, category, or page and preserve existing links.

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.

When automatic redirects are enabled and you save a category, all product and category rewrites are generated in real time and stored in rewrite tables by default. This process could result in significant performance issues for categories with many assigned products. The solution is to change this default and skip the generation of category/products URL rewrites of products for category save. In this case, product rewrites are generated only for the canonical product URL. See Automatic product redirects for more information.
In the process of redirection, all GET parameters specified in the URL are removed for security reasons.

Search engine optimization - create permanent URL redirect

Canonical URLs

For SEO purposes, is a good idea that each of your web pages has 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 crawl 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 runs the risk of 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, including:


To specify a canonical page, see Google Search Central documentation.

Configure URL rewrites

Enabling Web Server Apache Rewrites is part of the initial Commerce setup. Commerce routinely uses URL rewrites to remove the file name index.php that normally appears in the URL just after the root folder. When Web Server Rewrites are enabled, the system rewrites each URL to omit index.php. The rewrite removes words that convey nothing of value to search engines or customers, and has no impact on performance or site rank.

URL without Web Server Rewrite


URL with Web Server Rewrite

  1. On the Admin sidebar, go to Stores > Settings > Configuration.

  2. In the left panel where General is expanded, choose Web.

  3. Expand Expansion selector the Search Engine Optimization section.

    General configuration - web search engine optimization {width="600" modal="regular"}

  4. Set Use Web Server Rewrites to your preference.

  5. When complete, click Save Config.

Create URL rewrites

You can use the URL rewrite tool to create product and category rewrites, and custom rewrites for any page in your store. When the rewrite goes into effect, any existing links that point to the previous URL are seamlessly redirected to the new address.

URL rewrites can be used to add high-value keywords to improve the way the product is indexed by search engines. You can also use rewrites to create additional URLs for a temporary seasonal change, or permanent change. Rewrites can be created for any valid path, including CMS content pages. Internally, the system always references products and categories by their ID. No matter how often the URL changes, the ID remains the same. Here are some ways that you can use a URL rewrite:

System URL


Original URL


Redirected Product URL


Additional Category URLs


URL rewrites grid

Commerce offers these URL rewrite types:

URL rewrites demo

Watch this video to learn about managing URL rewrites: