Designing a URL structure for ecommerce websites
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.
/product/t-shirt#whiteare 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.
/product?sku=1234may 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.
/about?now=12:35ammay 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 best 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.
URL query parameter recommendations
Follow these recommendations when using query parameters to help Google successfully crawl and index your site.
?key=valueURL parameters rather than
?value, where possible. URL parameters allow Google Search to understand your site's structure and crawl and index more efficiently.
Avoid using the same parameters twice. Googlebot may ignore one of the values otherwise.
Avoid internally linking to temporary parameters, such as session-IDs, tracking codes, user-relative values (
time=last-week), and the current time. 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.
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
A query parameter, such as
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. Keep in mind that the product snippet uses product details of the canonical URL, such as price and availability.
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
/t-shirtas the canonical URL for all T-shirt variants
For a blue shirt, use
For a green shirt, use
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=1on 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_linkproperty of Google Merchant Center.
Include links directly on the pages using
Include meaningful text between
</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
metatag. 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.
Want to learn more? Check out the following resources: