Skip to main content
Technical

URL Structure for Ecommerce: Slugs, Canonicals, and Redirects

By ยท Updated ยท 9 min read

Why URL Structure Matters

URLs are a ranking signal. Google uses the words in a URL to understand what the page is about. Clean URLs with buyer keywords rank better than cryptic parameter strings. A page at /running-shoes/trail-running/ sends an immediate relevance signal that /products?id=49382&cat=7 cannot match. This is not theory โ€” Google's own documentation confirms that URL words are used for understanding page content and topic relevance.

URLs also affect click-through rate. In search results, users see the full URL path beneath the title. A user scanning results is more likely to click a result showing /running-shoes/trail-running/ than one showing /products?id=49382&cat=7. The clean URL communicates relevance before the user even reads the meta description. Across hundreds of product and category pages, this CTR advantage compounds into meaningful traffic differences.

And URLs are permanent. Changing them later requires 301 redirects that can temporarily lose link equity and create redirect chains. External sites that linked to your old URL will pass through a redirect indefinitely. Internal links need updating. Search Console data fragments between old and new URLs. The cost of changing URL structure post-launch is high enough that getting it right from the start is one of the highest-leverage technical SEO decisions an ecommerce store can make. For how URLs fit into the broader architecture, see the guide on site architecture for ecommerce SEO.

The Ideal URL Pattern

Products: /[category]/[product-name]/ โ€” for example, /running-shoes/salomon-x-ultra-4-wide/. The category prefix provides topical context and the product slug contains the buyer keyword. Categories: /[category]/ โ€” for example, /running-shoes/ or /running-shoes/trail/. Subcategories nest naturally within the parent. Content: /[content-section]/[topic]/ โ€” for example, /guides/best-trail-running-shoes/ or /blog/how-to-choose-running-shoes/. The content section signals the page type while the slug targets the query.

The rules are simple: lowercase only (mixed case creates duplicate URL risk), hyphens between words (not underscores โ€” Google treats hyphens as word separators), no stop words unless needed for readability (prefer /best-trail-running-shoes/ over /the-best-shoes-for-trail-running-in-2026/), and no parameters unless required for filtering. Keep URLs under 75 characters when possible. Every extra character is a character that dilutes the keyword signal and makes the URL harder to share, remember, and link to.

This pattern works because it mirrors how humans think about product hierarchies. A shopper looking for trail running shoes expects to find them within a running shoes section. The URL confirms that expectation. Search engines reward URLs that match user mental models because those URLs tend to live within well-structured sites โ€” and well-structured sites tend to have better content.

Ideal URL Hierarchy Three rows showing ideal URL patterns for ecommerce: category URLs with keyword path, product URLs with category and product name, and content URLs with section and topic โ€” keywords highlighted in each path Category yourstore.com / running-shoes / Product yourstore.com / running-shoes / salomon-x-ultra-4 / Content yourstore.com / guides / best-trail-running-shoes / Keywords in path = ranking signal + user trust
Clean URL hierarchy: category keywords in teal, product keywords in mint, content keywords in purple โ€” each path readable by humans and machines

Platform URL Constraints

Not every ecommerce platform gives you full control over URL structure. Shopify forces /products/ prefix on product pages and /collections/ on categories โ€” you cannot remove these. WooCommerce allows full customization via permalink settings โ€” you can achieve the ideal /category/product-name/ pattern. BigCommerce allows custom URL structures without forced prefixes. Wix uses /product-page/ and /shop/ by default but these are editable in site settings. Squarespace forces /store/ prefix on product pages.

These constraints are not SEO-breaking. Google handles prefixes fine โ€” Shopify stores rank well despite the /products/ and /collections/ prefixes. The forced prefix adds characters but does not dilute the keyword signal in the slug itself. What matters most is the slug: /products/salomon-x-ultra-4-wide/ still contains the target keyword. Stores with URL control (WooCommerce, BigCommerce) can build slightly cleaner structures, but the difference is marginal compared to content quality and link equity.

Where platform constraints create real problems is in category nesting and content URLs. Shopify limits collection URL depth โ€” you cannot create /collections/running-shoes/trail/ natively. WooCommerce supports unlimited nesting but deep nesting (more than 3 levels) creates excessively long URLs that dilute keyword density. The practical advice: work within your platform's constraints, optimize what you can control (the slug), and do not switch platforms solely for URL structure. For platform-specific guidance, see the Shopify SEO guide.

Canonical Tags: When Multiple URLs Exist

Canonical tags (rel="canonical") tell Google which URL is the definitive version when the same content is accessible at multiple URLs. This is one of the most common technical SEO problems in ecommerce because stores naturally create duplicate URLs through their navigation, filtering, and sorting features. Without proper canonicalization, Google splits ranking signals across multiple URLs instead of consolidating them on one.

Common scenarios where canonicals are essential: a product accessible via /products/shoe/ AND /collections/running/shoe/ (canonical to /products/shoe/). Filtered pages: /shoes?color=blue (canonical to /shoes/ unless the filtered page targets distinct search intent). HTTP and HTTPS versions of the same page (canonical to HTTPS). www and non-www variants (canonical to whichever you have chosen as primary). Paginated category pages (/shoes?page=2) should self-canonicalize โ€” each page has unique content.

Every page on your site should have a self-referencing canonical tag at minimum. This is defensive canonicalization โ€” it tells Google "this is the correct URL for this content" even when no duplicate exists today. Parameters get appended by analytics tools, affiliate tracking, and social sharing. Without a self-referencing canonical, those parameter-appended URLs can dilute your page's ranking signals. For a deeper dive into the duplicate content problem, see the guide on duplicate content in ecommerce.

301 Redirects: When URLs Change

If you change a URL โ€” product rename, site restructure, platform migration โ€” 301 redirect the old URL to the new one. A 301 tells Google and browsers that the page has permanently moved to a new address. This preserves link equity from external links and bookmarks. Without a redirect, the old URL returns a 404 error, all link equity from external links to that URL is lost permanently, and Google removes the old URL from its index. The new URL starts from zero authority regardless of how established the old URL was.

Rules for effective redirects: redirect to the most similar page (do not redirect everything to the homepage โ€” Google treats mass-homepage redirects as soft 404s). Map old URLs to new equivalents one-to-one wherever possible. Set up redirects before the change goes live โ€” there should be zero window where the old URL returns a 404. Monitor 404 errors in Search Console for 30 days after any URL change. Redirects pass 95%+ of link equity โ€” temporary ranking dips of 5-15% are normal and recover within 2-4 weeks as Google processes the redirect.

Redirect chains (A redirects to B, B redirects to C) lose a small amount of equity at each hop and slow page load. Keep chains to a maximum of one hop. If you discover a chain, update the first redirect to point directly to the final destination. Never use 302 (temporary) redirects for permanent URL changes โ€” 302s do not pass full link equity and signal to Google that the old URL may return, preventing full consolidation.

Handling Product Variants in URLs

Approach 1: One URL per product with variant selector. Color, size, and material variants are selected via dropdown or swatch on the product page โ€” the URL does not change. This is the default for most platforms (Shopify, WooCommerce). Best when variants are the same product in different options โ€” a blue shoe and a red shoe are the same product with a color choice, not distinct products. All link equity consolidates on a single URL. All reviews consolidate. One page ranks for the product name keyword.

Approach 2: Separate URLs per variant. Each variant gets its own URL: /shoes/salomon-x-ultra-4-blue/, /shoes/salomon-x-ultra-4-red/. Best when variants have distinct search demand โ€” "blue running shoes" has volume as a query independent of the base product. Also appropriate when variants differ materially (different materials, different features) rather than just cosmetically. If using separate URLs, canonical to the primary variant when content is near-identical across variants. Make each variant page genuinely unique (distinct images, distinct copy, distinct reviews) if they will each target distinct keywords.

The decision framework: check search volume. If "blue salomon x ultra 4" has meaningful search volume distinct from "salomon x ultra 4," separate URLs capture that demand. If color variants do not have independent search volume, consolidating on one URL is stronger. Most ecommerce stores benefit from the single-URL approach for 90%+ of products, with separate URLs reserved for high-demand variants where the keyword data justifies the additional URL.

URL Migration Checklist

When changing platforms or restructuring your site's URL architecture, follow this sequence to preserve ranking equity. (1) Export all current URLs โ€” every product, category, content page, and image URL that has external links or search traffic. (2) Map each old URL to its new equivalent. This is the most time-consuming step and the most important. Do not automate with find-and-replace alone โ€” verify mappings manually for your highest-traffic pages. (3) Implement 301 redirects before going live. The redirect map should be active on the new platform before the DNS switch.

(4) Test redirects before launch using curl -I or Screaming Frog โ€” verify each redirect returns a 301 status code and points to the correct destination. (5) Update internal links to point to new URLs directly. Internal links should never pass through redirects โ€” they should point to the final destination URL. (6) Submit a new sitemap to Search Console immediately after migration. (7) Monitor 404 errors in Search Console daily for 30 days after migration โ€” catch any URLs you missed in the mapping.

(8) Keep redirects in place permanently. Do not remove them after 6 months or a year. External links persist forever โ€” a blog post from 2019 linking to your old product URL will send visitors to a 404 if you remove the redirect. The computational cost of maintaining redirects is negligible. The cost of removing them is lost traffic and lost link equity from every external link that pointed to the old URL structure. For more on how category pages factor into migration planning, see the guide on collection page SEO.

Frequently asked questions

Do keywords in URLs affect rankings?

Yes, modestly. Google uses URL words as a relevance signal. A page at /running-shoes/trail/ has a slight advantage over /products/item-49382 for "trail running shoes" queries. The effect is small compared to content and links, but it compounds across hundreds of pages and improves click-through rate.

Should I include category in the product URL?

If your platform allows it (WooCommerce, BigCommerce), yes. Including category creates a path that signals topical context: /running-shoes/salomon-x-ultra-4/ tells Google this is a running shoe before reading the page. If your platform forces flat product URLs (Shopify: /products/salomon-x-ultra-4/), this is fine โ€” the ranking impact is minimal.

How long should URLs be?

Under 75 characters ideal, under 100 acceptable. Shorter URLs are easier to share, look cleaner in search results, and fit in more link contexts. Avoid unnecessary words: /best-trail-running-shoes/ beats /our-guide-to-the-best-trail-running-shoes-for-2026/.

What happens if I change a URL without a redirect?

The old URL returns a 404 error. All link equity from external links to that URL is lost. Google removes the old URL from its index. The new URL starts from zero authority. Traffic to the old URL drops to zero immediately. Always 301 redirect when changing URLs.

Should I use hyphens or underscores in URLs?

Hyphens. Google treats hyphens as word separators (running-shoes = "running" + "shoes") but treats underscores as word joiners (running_shoes = "runningshoes"). This is a confirmed Google recommendation. Always use hyphens between words in URLs.

MG
Written by

Matt is the founder of RunOctopus. He built All Angles Creatures from zero to page-1 rankings in reptile feeder insects in under 60 days using exactly this method โ€” turning a hard, entrenched niche into RunOctopus's proof store for programmatic SEO and AI search citation.

Connect on LinkedIn →

See what Otto would build for your store

Free architecture preview. No card required. Five minutes.

Generate Preview →