What is a trailing slash?
A trailing slash is the / at the very end of a URL, as in example.com/shoes/. Historically it marked a directory, and its absence marked a file. To search engines, /shoes and /shoes/ are two separate URLs, so a site should pick one form and stick to it.
Neither form ranks better. The cost comes from mixing them.
Where the slash matters and where it does not
| URL pair | Same URL? |
|---|---|
https://example.com and https://example.com/ | Yes. The root always has a path of / |
https://example.com/shoes and https://example.com/shoes/ | No. Two addresses |
https://example.com/file.pdf and https://example.com/file.pdf/ | No, and the second usually breaks |
For the homepage there is nothing to fix: browsers and crawlers request / either way. For every other path, if both versions answer 200 with the same content you have a duplicate pair, and links pointing at the two forms are split until Google works out which one is canonical.
Choosing and enforcing one form
- Pick the form your platform produces by default.
- Make the other form 301 redirect to it.
- Use the chosen form in internal links, canonical tags, the XML sitemap and hreflang annotations.
Step 3 is where sites slip. If the menu links to /shoes and the server redirects to /shoes/, every internal click and every crawl of that link costs an extra hop, and combined with an HTTP-to-HTTPS or www rule it becomes a redirect chain.
Check with a header request:
$ curl -I https://example.com/shoes
HTTP/2 301
location: https://example.com/shoes/
Trailing slashes in WordPress
WordPress takes its cue from the permalink structure in Settings → Permalinks. If the structure ends in a slash, as /%postname%/ does, WordPress adds one to post, page and archive links and redirects the slashless form to the slashed one. If the structure ends without it, the reverse happens. Changing that final character on an established site changes every URL on it, so treat it as a migration with redirects, not a tidy-up; our guide to changing permalinks without losing SEO covers the steps.
Files keep their extension and never take a slash, which is why sitemap and feed addresses like /sitemap.xml end the way they do.
Mistakes we see
- Hand-typed internal links in the other form. They work, through a redirect, on every click.
- Canonical tags that disagree with the redirect. The redirect says slash, the tag says no slash.
- A CDN or server rule that strips slashes while the application adds them. That produces a redirect loop.
- Relative links breaking.
href="images/a.png"resolves differently from/shoesand/shoes/, so switching forms can break assets.
Common questions
Is a trailing slash better for SEO?
No. Google has no preference. What matters is that only one version returns the content, the other redirects to it, and your links use the version you kept.
Does the homepage need a trailing slash?
It makes no difference. A request for the bare hostname is always a request for the root path, so both forms are the same URL.
Does WordPress add a trailing slash automatically?
Yes, when your permalink structure ends with one. WordPress then redirects requests for the version without it. The behaviour follows the last character of the structure.