Trailing slashes and SEO: does it matter?

·4 min read

For trailing slash SEO, the slash itself never helps or hurts a ranking. What matters is that Google treats /pricing and /pricing/ as two different URLs, so a site that answers 200 on both has every page twice. Pick one form, send the other to it with a single permanent redirect, and make your canonical tags, internal links and sitemap all use the form you picked.

The root is the one exception. https://example.com and https://example.com/ are the same URL, and you can't redirect one to the other.

Does a trailing slash matter for SEO?

It matters only when both versions load. Google's post To slash or not to slash says it treats each form as its own URL, and that a server may even return different content at each. It doesn't read the slash as "folder" and its absence as "file".

When both forms return the same page with a 200, Google has to pick one to index. It usually picks well. The cost is elsewhere. Links and shares split across two addresses, Googlebot crawls everything twice, and Search Console reports half your URLs as duplicates. On a 50-page brochure site that's noise. On a store with 40,000 product URLs, it doubles the crawl.

Which form you pick doesn't matter. I lean toward whatever your framework already does, because fighting the default is how loops start.

How to fix trailing slash duplicates

Make one form the only one that answers 200. In order:

  1. Choose the form. Check which one most of your internal links and backlinks already use, and keep that.
  2. Redirect the other form with a 301 or 308. Both are permanent, and 307 vs 308 redirects explains the method difference. Avoid 302s here.
  3. Point the canonical tag at the chosen form. <link rel="canonical" href="https://example.com/pricing"> on a page served at /pricing/ sends Google a mixed signal. The canonical tag guide covers the rest.
  4. Fix internal links, nav, footer and sitemap so they link the final URL. A link to the redirecting form costs every visitor a hop.
  5. Leave files alone. /robots.txt, /sitemap.xml and /logo.png should never get a slash added.

If you're on Apache, the copy-paste rules for adding or removing the slash are in .htaccess redirects. One warning carries over to every stack. Two rules that each "fix" the slash in opposite directions bounce the URL until the browser shows ERR_TOO_MANY_REDIRECTS.

Most platforms already redirect one form to the other. Know which one yours picks before writing a rule.

Platform Default How to change it
Next.js Redirects /about/ to /about trailingSlash: true in next.config.js flips it
WordPress Follows the permalink structure, and redirect_canonical() sends a 301 to match Add or drop the final / in Settings > Permalinks
Vercel (vercel.json) trailingSlash undefined, so both forms load with no redirect Set true or false for a 308 redirect
Netlify Pretty URLs on, so /about goes to /about/ Toggle Pretty URLs in post processing

A few details from the docs.

Next.js. With trailingSlash: true, the Next.js docs say files with an extension and paths under .well-known/ keep no slash.

WordPress. redirect_canonical() sends a 301 by default and builds the URL with user_trailingslashit(), which adds or removes the slash depending on whether your permalink structure ends in one, per the WordPress reference. A structure of /%postname%/ means slashes everywhere.

Vercel. The vercel.json reference says that with trailingSlash left undefined, /about and /about/ both serve the same content, and it calls this not recommended for search. Set it explicitly. A Next.js app on Vercel normally takes its slash handling from next.config.js, so set it in one place, not both.

Netlify. Its CDN matches redirect rules with or without the slash, so a _redirects rule that removes slashes loops. The Netlify redirect docs say you can't add or remove a slash with a redirect rule and point to Pretty URLs instead.

How to check which form your site serves

Request both forms and read the status codes:

curl -sI https://example.com/pricing | grep -iE "^(HTTP|location)"
curl -sI https://example.com/pricing/ | grep -iE "^(HTTP|location)"

You want one 200 and one 301 or 308 whose Location is the other form. Two 200s mean duplicates. Two redirects pointing at each other mean a loop. A redirect to a third URL, such as http or the other host, means a redirect chain that should collapse to one hop.

Then check one page's source for the canonical, and crawl a few internal links. If your nav links /pricing/ while the server prefers /pricing, every click pays a redirect.

Trace trailing slash redirects on your site

The Redirect Chain & HTTP Header Checker follows a URL hop by hop and lists each status code and Location target. Run it on both forms of a page. It flags loops, chains with more than one redirect, temporary redirects that change host, HTTPS sent back to HTTP and slow hops, and confirms that the http, https, www and bare versions of your domain end at one URL. It also reports headers such as X-Robots-Tag: noindex.

It doesn't compare the two slash forms for you, so that's two runs. It reads HTTP redirects only, not JavaScript or meta refresh redirects past the first document, and it doesn't read canonical tags. A run costs 10 credits.

Keep reading