Go behind the scenes of Google Search and listen to our SEO podcast, Search Off the Record.

Designing a URL structure for ecommerce sites

Well-designed URLs can help Google more efficiently locate and retrieve web pages on your ecommerce site. If you control the structure of your URLs (for example, you are building your own site from scratch), then this guide can help you decide on your URL structure to avoid indexing problems seen by Google on ecommerce sites.

Why URL structure matters

A good URL design structure helps Google crawl and index your site, while a poor URL structure can lead to the following issues:

  • Content can be missed if Googlebot incorrectly thinks two URLs will return the same content as only one URL may be retrieved by the crawler (the other is discarded as a duplicate). This can happen if fragment identifiers (like #fragment) are used to show different content. Google does not use fragment identifiers in indexing.

    Example: /product/t-shirt#black and /product/t-shirt#white are considered to be the same page by Google.

  • The same content may be retrieved multiple times by the crawler if Google thinks two URLs are different but result in the same page being returned. This can slow down the crawling of your site and put additional load on your web server for no benefit.

    Example: /product/black-t-shirt and /product?sku=1234 may return the same product page, but Google cannot determine this by looking at the URL alone.

  • The crawler may think your site contains an infinite number of pages if your URLs include a continually changing value such as a timestamp. As a result, Google may take longer to find all the useful content on your site.

    Example: /about?now=12:34am and /about?now=12:35am may be treated as different URLs by Google even though both URLs display the same page.

See How Google Search Works and How Google's Site Crawlers Index Your Site for more information on how Google crawls and indexes your site.

Good URL structure design practices

To optimize how Google crawls and indexes your website, follow these best practices on how to structure your URLs.

General URL recommendations

  • Minimize the number of alternative URLs that return the same content to avoid Google making more requests to your site than needed. Google may not realize that two URLs return the same page until after both are retrieved.
  • If upper and lower case text in a URL is treated the same by the web server, convert all text to the same case so it is easier for Google to determine that URLs reference the same page.
  • Make sure each page in paginated results has a unique URL. We see the most URL mistakes in pagination URL structures.
  • Add descriptive words in URL paths. The words in URLs may help Google better understand the page.

    Recommended: /product/black-t-shirt-with-a-white-collar

    Not recommended: /product/3243

URL query parameter recommendations

Follow these recommendations when using query parameters to help Google successfully crawl and index your site.

  • Use ?key=value URL parameters rather than ?value, where possible. URL parameters allow Google Search to understand your site's structure and crawl and index more efficiently.

    Recommended: /photo-frames?page=2, /t-shirt?color=green

    Not recommended: /photo-frames?2, /t-shirt?green

  • Avoid using the same parameters twice. Googlebot may ignore one of the values otherwise.

    Recommended: ?type=candy,sweet

    Not recommended: ?type=candy&type=sweet

  • Avoid internally linking to temporary parameters, such as session-IDs, tracking codes, user-relative values (location=nearby, time=last-week), the current time, etc. This can result in URLs that have a short life or duplicate URLs for the same page. To get the best results from Google Search, use long-term, persistent URLs.

    Recommended: /t-shirt?location=UK

    Not recommended: /t-shirt?location=nearby, /t-shirt?current-time=12:02, /t-shirt?session=123123123

  • Tell Google which query parameters to ignore in your URLs by using the URL parameter settings in Search Console.

How Google understands URLs for product variants

A common consideration on ecommerce sites is how to structure URLs when a product is available in multiple sizes or colors. Each combination of product attributes is referred to as a product variant. Google supports a wide range of URL structures for product variants.

If you choose to include multiple product variants on a single page (meaning, the variants share the same URL), be aware of the following limitations:

  • The page may be ineligible for Product rich results in search results because the experience is only supported for pages holding a single product (and product variants may be treated as distinct products by Google Search).
  • Experiences such as Google Shopping cannot take a user to a specific variant of a product on your site, leading to the user needing to select the variant they wish to purchase on your site before checkout. This can lead to a poor user experience if the shopper already selected the variant they wanted in Google Shopping.

If you choose to use a distinct URL per variant, Google recommends using either:

  • A path segment, such as /t-shirt/green
  • A query parameter, such as /t-shirt?color=green

To help Google understand which variant is best to show in Search, choose one of the product variant URLs as the canonical URL for the product.

If you use optional query parameters to identify variants, use the URL with the query parameter omitted as the canonical URL. This can help Google better understand the relationship between product variants. For example, if the default value of the color query parameter for a T-shirt is blue, then

  • Use /t-shirt as the canonical URL for all T-shirt variants
  • For a blue shirt, use /t-shirt (and not /t-shirt?color=blue)
  • For a green shirt, use /t-shirt?color=green
A canonical blue T-shirt without color query parameter and a non-canoical green T-shirt with color query parameter specified

Using URLs in your content

To help Google Search and Google Shopping correctly identify your products and the relationship between product variants, follow these best practices when using URLs in your content.

  • Use the same URL in internal links, sitemap files, and <link rel="canonical"> tags. For example, if linking to the first page in a paginated sequence using a query parameter where the default page is page one, either include or exclude ?page=1 on the URL throughout your site consistently.
  • Use a self-referencing <link rel="canonical"> tag (one where the URL in the tag points to the current page) on all indexable pages and include those URLs in a sitemap file.
  • For products with unique URLs per variant, include the canonical product URL on all variant pages using a <link rel="canonical"> tag. For more information, see the canonical_link property of Google Merchant Center.
  • Include links directly on the pages using <a href> tags; don't use JavaScript to navigate between pages. Googlebot might not detect navigation from JavaScript code. For more information about how Google processes JavaScript, see Understand the JavaScript SEO basics.
  • Include meaningful text between <a href> and </a> tags where possible, such as the title of the product being linked to. Don't use generic phrases such as "click here".
  • Avoid linking to, or at least indexing, pages without useful content. If a category has no items, use a noindex robots meta tag. If your site detects that a category has become empty and automatically removes the category from on-site search and browse, consider returning a 404 (not found) HTTP status code for the page.

Additional resources

Want to learn more? Check out the following resources: