TECHNICAL
URL Structure SEO: How to Format URLs for Better Rankings
How URL structure affects crawlability, keyword signals, and link equity. Best practices for slugs, directory depth, parameters, and restructuring URLs without losing rankings.
Published July 13, 2026 · 10 min read
URL structure is one of those SEO signals that operates quietly in the background—until something goes wrong. A site migration with poorly planned redirects, a product URL that exposes session IDs, or a legacy date-based permalink structure can all create persistent crawlability and ranking problems that take months to surface in GSC data.
This guide covers what URL structure actually does for SEO, the specific rules that matter (with the reasons behind them), and how to restructure existing URLs without hemorrhaging link equity.
Why URL structure matters for SEO
URL structure affects four distinct SEO mechanisms:
Canonicalization. URLs are identifiers. When Google sees example.com/shoes, example.com/shoes/, example.com/SHOES, and example.com/shoes?ref=email as separate strings, it has to decide which is the canonical version—and it doesn't always choose the one you want. Consistent URL structure reduces the number of de-duplication decisions Google has to make.
Keyword signals. The URL path is a mild ranking signal. "mild" is accurate—a keyword-descriptive URL won't make a bad page rank, but it confirms topical relevance and is readable in SERPs, which affects CTR. Google's John Mueller has confirmed that keywords in URLs provide a small signal that can make a difference in competitive situations.
Link equity. Inbound links point to specific URLs. If /shoes and /shoes/ are treated as two separate pages, the link equity splits between them. If example.com/blog/2023/04/12/how-to-clean-shoes/ and example.com/blog/how-to-clean-shoes/ both exist, links are distributed across both. Clean URL structures consolidate link equity.
User comprehension. A URL visible in search results and browser address bars contributes to click-through rate and user trust. example.com/p?id=83947 communicates nothing about content; example.com/how-to-clean-leather-shoes communicates exactly what the page covers.
URL best practices
Use hyphens, not underscores
Google treats hyphens (-) as word separators: how-to-clean-shoes is read as "how to clean shoes." Underscores (_) are treated as connectors: how_to_clean_shoes is read as "howtocleanshoes" as a single token. For multi-word slugs, hyphens are required.
Use lowercase throughout
URLs are case-sensitive on most servers. Example.com/Blog/Post-Title and example.com/blog/post-title are technically two different URLs. Inconsistent casing creates duplicate content and canonical confusion. Redirect all uppercase/mixed-case variants to lowercase with 301 redirects and configure your web server to enforce lowercase URLs.
Keep slugs short and descriptive
No definitive word count maximum exists, but slugs with 3–6 words covering the core topic consistently perform better than either very short slugs (/p12) or very long ones (/this-comprehensive-guide-to-how-you-can-clean-your-leather-shoes-at-home-in-2026). Remove stop words where they don't affect meaning: how-to-optimize-images-for-seo → optimize-images-seo.
Exception: preserve stop words when they carry semantic meaning ("how to" searches where the "how to" is the intent signal) or when the phrase is a common keyword variant.
Avoid numeric IDs in URLs
example.com/products/8374892 and example.com/blog/?p=1293 are crawlable but useless for keyword signaling. They're also fragile: IDs exposed in URLs reveal database structure and make redirects harder when content is reorganized. Use keyword-descriptive slugs wherever possible.
Avoid date-based paths for evergreen content
example.com/blog/2021/03/how-to-clean-shoes/ creates a problem: the content is timeless but the URL embeds a year that makes it feel stale when it appears in 2026 SERPs. Evergreen content performs better with flat paths (example.com/blog/how-to-clean-shoes/). Reserve date paths for genuinely time-sensitive content (news articles, event-specific pages).
Maintain trailing slash consistency
Choose one convention—trailing slash or no trailing slash—and enforce it universally with 301 redirects. example.com/blog/ and example.com/blog are two different URLs without redirect enforcement. Most frameworks generate one or the other consistently; the risk is external links pointing to the non-canonical variant. Check your robots.txt, sitemap, and internal link hrefs to ensure they all use the same convention as your canonical configuration.
Keep query string parameters out of canonical content
example.com/products?sort=price&color=blue is a valid page to serve users but shouldn't be a canonical URL for indexing. Parameters for sorting, filtering, tracking (?utm_source=), session management, and currency selection should either be excluded from indexing (robots.txt Disallow or <meta name="robots" content="noindex">), canonicalized back to the base URL, or—for high-value filter combinations—created as dedicated pages with their own canonical URLs.
Directory depth and site architecture
Every click of depth from the homepage dilutes the PageRank that flows to a page through internal links. The generally cited guideline is that no important content page should be more than 3 clicks from the homepage—partly for crawl efficiency, partly to preserve link equity distribution.
This translates directly to URL structure:
example.com/category/page/= 2 levels deep, goodexample.com/category/sub-category/page/= 3 levels deep, acceptableexample.com/blog/archive/2021/march/week-2/post-title/= 6 levels deep, bad
For e-commerce with deep category trees, consider flattening product URLs. Shopify does this by design: all products live at example.com/products/[slug] regardless of the category they appear in—preventing deep nesting even for complex category structures.
For documentation sites, deep nesting from /docs/getting-started/installation/quick-start/ can be acceptable if the hierarchical structure reflects genuine content relationships, but keep important high-value pages shallow.
URL structure by site type
Blog
Recommended: /blog/slug/ or /blog/category/slug/
Including a topic category in the blog URL (/blog/technical-seo/url-structure-guide/) helps with topical clustering and internal linking patterns but adds one URL level. If you restructure the blog's category taxonomy later, it creates a redirect challenge. Flat blog/slug/ is simpler and avoids this.
Avoid: /blog/YYYY/MM/DD/slug/ for evergreen content.
E-commerce
Recommended: /products/[slug] for product pages; /category/[slug] for category pages
Avoid: /products/[category]/[sub-category]/[sub-sub-category]/[product-slug] — this embeds category hierarchy in product URLs, creating a redirect requirement when you reorganize categories.
Challenge: Products in multiple categories can generate multiple valid URLs. Solve with a single canonical URL per product (typically the "root" product URL without category prefix) and canonical tags on all other paths.
SaaS
Feature pages, use-case pages, and comparison pages should live at flat paths:
/features/[feature-name]/for/[use-case]/alternatives/[competitor]
Avoid burying these in /product/features/seo/[feature-name]—they won't rank as well from deep nesting.
Documentation
VitePress, Docusaurus, and similar documentation generators use file-system-based routing. A file at docs/getting-started.md generates /getting-started. Use meaningful file names as slugs. Consider the cleanUrls option in documentation frameworks to remove .html extensions from URLs.
How to restructure URLs without losing rankings
URL restructuring is one of the highest-risk SEO operations. Done correctly, it's transparent to rankings. Done incorrectly, it can take 6–12 months to recover from.
Step 1: Crawl the current URL structure. Export every indexed URL from Google Search Console (Coverage report → Indexed). Identify all canonical URLs that have inbound links or GSC traffic. These are the URLs with link equity to preserve.
Step 2: Build a redirect map before changing anything. For every current URL, specify the new URL. The redirect map is the most important deliverable of a URL restructure. If you're restructuring /blog/2021/03/shoes/ → /blog/how-to-clean-shoes/, that specific redirect must be in the map.
Step 3: Implement 301 redirects, not 302. 302 (temporary) redirects do not pass link equity. 301 (permanent) redirects pass PageRank to the destination URL. Every URL being restructured needs a 301, not a 302.
Step 4: Avoid redirect chains. A chain A → B → C passes less equity than a direct A → C redirect. After a restructure, audit for chains and collapse them into direct redirects.
Step 5: Update internal links. After implementing redirects, update all internal links to point directly to new URLs. Redirects add latency; internal links pointing through redirects also dilute link equity unnecessarily.
Step 6: Update the sitemap. Submit a sitemap with new canonical URLs only. Remove old URLs. Update the sitemap's lastmod dates to signal the change.
Step 7: Monitor GSC post-migration. In Google Search Console, check Coverage (new URLs being indexed, old URLs returning 301 status), Core Web Vitals (redirect chains increasing TTFB), and Performance (impression and click continuity across the restructure).
Step 8: Don't rush the consolidation. After a major URL restructure, it takes Google 2–4 weeks to recrawl most pages and update its index. Rankings may appear to drop during this period as Google processes the changes. This is normal—monitor for 4–6 weeks before drawing conclusions about ranking impact.
Framework-specific URL generation
WordPress
WordPress permalink settings (Settings → Permalinks) control URL structure for all posts. Post name (/%postname%/) generates clean flat slugs. Custom structure (/blog/%postname%/) adds a category prefix. The permalink structure applies to all new posts; changing it requires redirects for all existing URLs.
Common WordPress URL problems: Gutenberg auto-generates slugs from the title, including stop words and long phrases. Review and shorten the auto-generated slug before publishing. Yoast SEO and Rank Math show the URL in the editor interface for review.
Next.js
Next.js App Router uses file-system-based routing: app/blog/[slug]/page.tsx generates /blog/[slug]. Slugs come from generateStaticParams(), which fetches content from wherever your content lives (MDX files, CMS API, database). The slug quality depends on what you store in your content source—keyword-descriptive slugs in your CMS/frontmatter produce keyword-descriptive URLs.
Shopify
Shopify's URL structure is fixed at the platform level: products live at /products/[handle], collections at /collections/[handle], blogs at /blogs/[blog-name]/[article-handle]. You cannot change this structure. The "handle" is the slug and is auto-generated from the product/collection/article title—review handles before publishing, as they're difficult to change later (Shopify does create 301 redirects for handle changes but doesn't update all internal links automatically).
Django / Laravel / Rails
Server-side frameworks generate URLs from route configurations. Django's path('products/<slug:slug>/', views.product_detail) creates clean URL patterns. The slug field in the database model should be populated with keyword-descriptive values at creation time. Avoid exposing numeric primary keys in URLs unless the slug field is separate from the PK.
Common URL mistakes and how to fix them
Session IDs in URLs (?SESSID=abc123): Disallow the parameter pattern in robots.txt and canonicalize all session-parameter variants to the base URL. Configure your server or CDN to strip session parameters before they reach the URL.
Duplicate URLs from parameter combinations: Use canonical tags pointing to the parameterless URL on filter/sort result pages. For high-traffic filter combinations that deserve separate index entries, create dedicated category pages with their own canonical URLs.
www vs non-www inconsistency: Configure one as canonical, 301 redirect the other. Set the canonical in Google Search Console (Settings → Change of address) if migrating from one to the other.
Mixed protocol (http:// vs https://): All HTTP requests should 301 to HTTPS. Internal links must use HTTPS to avoid triggering mixed content warnings and redirect chains.
Trailing slash inconsistency: Enforce one convention with 301 redirects at the server/CDN level. Match the convention in your sitemap, canonical tags, and all internal link hrefs.
FAQ
Do keywords in URLs improve rankings?
Keywords in URL slugs provide a small positive signal—Google uses them to confirm topical relevance. The effect is minor compared to title tags, headings, and body content, but it's a consistent signal. More practically, descriptive URLs improve CTR in search results (users see what the page covers before clicking) and make SERP display cleaner. The recommendation to use keyword-descriptive slugs is justified by multiple smaller benefits rather than one large ranking boost.
How long should a URL slug be?
3–6 words is a common practical guideline, but the real principle is "as short as it can be while remaining descriptive and unique." Remove stop words that don't affect meaning. best-leather-shoe-cleaning-guide → clean-leather-shoes. Don't artificially truncate slugs to the point of ambiguity—a very short slug that could describe multiple pages creates canonicalization problems.
Should I restructure URLs to improve rankings?
Restructuring URLs for keyword improvement rarely produces significant ranking gains if the existing URLs are already indexable and crawlable. The risk of a restructure (redirect chains, missed redirects, internal link staleness) usually outweighs the marginal gain from better-named slugs. Prioritize URL restructuring when: the existing structure has technical problems (parameter-based canonical URLs, duplicate content from slash inconsistency, session IDs in canonical URLs), or when you're already doing a platform migration that requires a restructure anyway.
What's the difference between a URL slug and a URL path?
A slug is the human-readable identifier for a specific page—the final segment of the URL (how-to-clean-shoes). A path is the full URL structure including all directory segments (/blog/cleaning/how-to-clean-shoes). The slug is what you write; the path is determined by both the slug and the directory structure you place it in.
MORE FROM THE BLOG
Related articles
11 min read
YouTube SEO: How to Rank Videos on YouTube and Google Search
YouTube SEO covers title optimisation, description keyword placement, chapters, thumbnails, closed captions, and the watch signals that drive YouTube and Google ranking.
Read →7 min read
Voice Search SEO: How to Optimise for Voice Queries and AI Assistants
How voice search queries differ from typed queries, what technical signals (FAQ schema, speakable schema, featured snippet eligibility) matter for voice results, and why optimising for voice search overlaps heavily with AI visibility.
Read →10 min read
TikTok SEO: How to Rank in TikTok Search and Get Discovered in Google
TikTok SEO covers how to optimise videos for TikTok's internal search algorithm, how TikTok content ranks in Google Search, and how TikTok presence feeds into AI answer systems.
Read →Run DeepSEOAnalysis on your own site.
Free, no signup. Technical SEO, Core Web Vitals, structured data, and AI visibility in one report.
Run a free audit →