Skip to main content
Beta: Front-End Checklist is currently in beta. Some issues are still being fixed. Thanks for your patience.
SEOMedium

Use trailing slashes consistently

Checks for consistent trailing slash usage across all URLs to avoid duplicate content and canonicalization issues.

Utilities
Quick take
Typical fix time 10 min
  • Pick one convention — trailing slash or no trailing slash — and enforce it site-wide with 301 redirects
  • Both `/page/` and `/page` must not return HTTP 200; one must redirect to the other
  • Set `rel="canonical"` to the preferred version on all pages
  • Ensure all internal links, sitemaps, and canonical tags use the same convention
Why it matters: Inconsistent trailing slashes create duplicate content — Google sees `/page` and `/page/` as two separate URLs competing for the same ranking, splitting PageRank between them.

Rule Details

A trailing slash makes /page/ different from /page at the HTTP level. Without consistent handling, you have two URLs serving the same content — a classic duplicate content problem.

Code Examples

Option A: Prefer no trailing slash (common for frameworks like Next.js)

preferred URL → 200 OK
alternate slash variant → 301 → preferred URL

Option B: Prefer trailing slash (common for WordPress, Apache-based sites)

preferred slash URL → 200 OK
alternate no-slash variant → 301 → preferred slash URL

Why It Matters

Inconsistent trailing slashes create duplicate content — Google sees /page and /page/ as two separate URLs competing for the same ranking, splitting PageRank between them.

The Problem

URLHTTP StatusIssue
/about200 OKContent served
/about/200 OKSame content — DUPLICATE

Both versions appear in Google's index as separate pages, splitting link equity and creating canonicalization ambiguity.

Implementation

Next.js

// next.config.js
module.exports = {
  trailingSlash: false,   // 'true' for trailing slash preference
}

Nginx

# Redirect trailing slash to no-slash
rewrite ^/(.*)/$ /$1 permanent;

Apache

# Remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [R=301,L]

Canonical Tags

Regardless of server redirects, add canonical tags pointing to the preferred version:

<!-- On https://example.com/about (preferred) -->
<link rel="canonical" href="https://example.com/about">
 
<!-- If the trailing slash version also serves: -->
<!-- On https://example.com/about/ -->
<link rel="canonical" href="https://example.com/about">

❌ Common Mistakes

<!-- Canonical points to trailing slash but all internal links omit it -->
<link rel="canonical" href="https://example.com/about/">
<a href="/about">About</a>   <!-- Creates a redirect per navigation -->
 
<!-- Sitemap mixes conventions -->
<loc>https://example.com/about</loc>
<loc>https://example.com/contact/</loc>

Checking Consistency

curl -I https://example.com/about
curl -I https://example.com/about/

One must return HTTP/1.1 301 with a Location: header pointing to the preferred URL.

Exceptions

  • Staging, utility, login, account, or internal search pages may intentionally use different crawl or index signals if they are not meant to rank.
  • Temporary migration states can produce noisy intermediate signals; flag the live production URL pattern, not one-off transition artifacts.
  • When redirects, canonicals, robots directives, or indexability signals conflict, fix the strongest final signal first instead of reporting every downstream symptom as a separate blocker.

Standards

  • Use these references as the standard for the final search-facing HTML, metadata, and crawl behavior.
  • Check the implementation against Google: Trailing slashes on URLs before treating the rule as satisfied.
  • Check the implementation against Google: Consolidate duplicate URLs before treating the rule as satisfied.

Verification

Automated Checks

  • Inspect rendered HTML and HTTP headers to confirm the expected metadata or crawlability signal is present.
  • Test the affected URL with Google Search Console or equivalent tooling where relevant.
  • Re-crawl a representative page set after deployment.

Manual Checks

  • Confirm the change does not create conflicting canonical-url, robots, or structured-data signals.

Use with AI

Copy these prompts to use with your AI assistant, or install the MCP server to use directly from Claude, Cursor, or Windsurf.

Check

Verify implementation

For a sample of URLs, test both the trailing-slash and non-trailing-slash versions. Both should NOT return HTTP 200 — one must 301-redirect to the other. Check that internal links, sitemap `<loc>` values, and canonical tags all use the same convention consistently.

Fix

Auto-fix issues

Choose a canonical URL convention. Add server or framework redirect rules so the non-preferred variant permanently redirects (301) to the preferred one. Update all internal links, canonical tags, and sitemap entries to use the preferred format.

Explain

Learn more

Explain why `/page` and `/page/` are treated as distinct URLs by default, how this creates duplicate content, and how 301 redirects and canonical tags resolve the ambiguity.

Review

Code review

Review metadata generation, rendered HTML, structured data, and response headers related to Use trailing slashes consistently. Flag exact routes or templates where search-facing output violates the rule, and describe how to verify the final page output.

Sources

References used to support the guidance in this rule.

Further Reading

Tools and supplementary material for exploring the topic in more depth.

Google Search Console
search.google.comTool

Rules that often go hand-in-hand with this one.

4XX Pages in Sitemap

Checks for sitemap URLs that return 4XX HTTP status codes, indicating broken or removed pages.

SEO
Avoid redirect chains on canonical URLs

Ensures that canonical tags point directly to the final destination URL without intermediate redirects.

SEO
Resolve internal broken links

Detects and fixes internal links that return 404 or 5xx errors to improve user experience.

SEO
Set canonical URLs for all pages

A canonical URL tag is present to prevent duplicate content issues.

SEO

Was this rule helpful?

Your feedback helps improve rule quality. This stays internal for now.

Loading feedback...
0 / 385