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:

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.

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

http://www.yourdomain.com/magento/index.php/storeview/url-identifier

URL with Web Server Rewrite

http://www.yourdomain.com/magento/storeview/url-identifier
  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

  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

 http://www.example.com/catalog/category/id/6

Original URL

http://www.example.com/peripherals/keyboard.html

Redirected Product URL

http://www.example.com/ergonomic-keyboard.html

Additional Category URLs

http://www.example.com/all-on-sale.html
http://www.example.com/save-now/spring-sale

URL rewrites grid

Commerce offers these URL rewrite types:

URL rewrites demo

Watch this video to learn about managing URL rewrites:

Previous pageSite maps
Next pageCategory rewrites

Commerce