squirrelscan
GitHub

Trailing slash: /page and /page/ are two different URLs

A file URL with a trailing slash is a mistake; a directory URL either has one or does not, consistently. squirrel reports the state of each path.

What the trailing slash decides

/about and /about/ are distinct URLs. A server can serve the same content at both, redirect one to the other, or serve one and 404 the other. Which it does is a configuration choice, not a property of the web.

Google’s own guidance is that either convention is fine as long as you pick one and redirect the other, because serving both without a redirect means one page has two addresses. The convention most sites use is a trailing slash for directory-like paths and none for a path that names a file with an extension.

What squirrel checks

The rule runs on every crawled page over the URL path only. A path is treated as a file when it ends in a dot followed by two to four alphanumeric characters. It emits a single check named trailing-slash:

  • Info on the root path. Message: Root URL (trailing slash check not applicable).
  • Pass when a file-like path has no trailing slash. Message: File URL correctly has no trailing slash.
  • Info for every other non-root path, reporting the state rather than judging it. Message: URL has trailing slash or URL has no trailing slash, with Ensure consistency across site as the value.

A fourth branch, File URL has trailing slash, exists in the code but cannot fire: the extension test anchors the extension to the end of the path, so /report.pdf/ fails it and falls into the informational branch above. That branch therefore covers extensionless paths and anything else the extension test rejects.

Severity is info and the weight is 3. Consistency across the site is not judged here: that is url/slug-convention, which computes the site’s own dominant form and reports the minority against it.

How to fix it

rewrite ^/(.*)/$ /$1 permanent;   # or the reverse, but only one

Pick a convention, apply it in the router, and redirect the other form permanently. Then make internal links, canonical tags and the sitemap all use the chosen form so no navigation takes the redirect.

Do not redirect in both directions. A rule that adds a slash and another that removes it produce a loop.

Rule IDurl/trailing-slash
CategoryURL Structure
ScopePer-page
Severityinfo
Weight3/10

Enable / disable

Disable this rule

[rules]
disable = ["url/trailing-slash"]

Disable all URL Structure rules

[rules]
disable = ["url/*"]

Enable only this rule

[rules]
enable = ["url/trailing-slash"]

enable replaces the default ["*"], so this is the only rule selected. Leave disable out: a rule that matches any disable pattern is skipped even when enable names it. Only an enabled setting under a rule’s own [rule_options] table overrides both lists.

URL Structure findings ship in every audit next to the SEO, performance and agent experience rules. See Fix SEO issues with AI for how an agent works through a report.

References

Check your site

Run squirrel audit https://example.com and open the URL Structure section of the report. Each path is reported with its current trailing-slash state. Signed-out local audits need no account and cost nothing. Signed-in audits spend credits.

Type to search…

↑↓ navigate↵ openesc close