Inconsistent trailing slashes across URLs
What Is This Issue
This issue checks whether your website uses a consistent trailing slash policy for URLs.
A trailing slash is the forward slash (/) at the end of a URL path. For example:
- With trailing slash:
https://example.com/blog/ - Without trailing slash:
https://example.com/blog
For this check to pass:
- Your site should consistently use either trailing slashes OR no trailing slashes (not both)
- If both variants exist, one should redirect to the other
- Canonical tags should align with your chosen format
Example: If your preferred format is https://example.com/blog/, then https://example.com/blog should redirect to https://example.com/blog/ with a 301 redirect.
Why Is This Important
Trailing slash consistency is important for:
- Duplicate content: Search engines treat URLs with and without trailing slashes as different pages. Without proper redirects, you may have duplicate content issues.
- Crawlability: Inconsistent URLs can waste crawl budget as search engines try to crawl both variants.
- Rankings: Link equity and ranking signals can be split between the two URL variants.
When trailing slash behavior is inconsistent, search engines may:
- Index both versions of the same page
- Split ranking signals between duplicate URLs
- Have difficulty determining the preferred version
Resolving this issue improves your SEO health score by consolidating ranking signals to a single preferred URL format.
How XeoPix Detects This
XeoPix identifies trailing slash inconsistencies through these steps:
-
Fetches the page: XeoPix requests the URL and follows any redirects to get the final URL.
-
Checks the final URL: The system examines whether the final URL path ends with a trailing slash or not.
-
Tests the alternate variant: XeoPix checks the opposite format (if final URL has a slash, it tests without; if without, it tests with).
-
Evaluates consistency: The system checks:
- Does the alternate variant redirect to the final URL?
- Is there a consistent pattern across the site?
- Do canonical tags align with the observed pattern?
-
Flags inconsistencies: XeoPix triggers warnings when:
- Both slash and non-slash variants return 200 status (no redirect)
- Redirects don’t consistently point to one format
- Canonical tags conflict with the observed pattern
The detection uses HTTP responses and URL comparisons only.
How To Fix
-
Choose a standard: Decide whether your site will use trailing slashes or not (e.g.,
example.com/page/vsexample.com/page). -
Set up redirects: Configure your server to redirect the non-preferred variant to the preferred one with a 301 (permanent) redirect.
-
Update canonical tags: Ensure all canonical tags point to the preferred URL format.
-
Update internal links: Make sure all internal links use the preferred format.
-
Update sitemaps: Ensure your XML sitemaps only include the preferred URL format.
-
Test thoroughly: Crawl your site to verify that all URL variants redirect correctly to the preferred format.
What We Store
Storage Level
Page Level
Database Table / Prisma Model
Urls
Stored Fields
| Field | Type | Description |
|---|---|---|
| url | string | The URL being analyzed |
| crawlDepth | Int? | The crawl depth of the URL |
Detection Dependencies
- HTML Document
- URL Structure
Examples
Example 1: Consistent trailing slash usage
Scenario: A website that consistently uses trailing slashes.
Passes because:
- All URLs end with trailing slashes
- Non-slash variants redirect to slash versions
- Canonical tags align with the trailing slash format
Preferred: https://example.com/blog/
Redirect: https://example.com/blog → https://example.com/blog/Example 2: Inconsistent trailing slash behavior
Scenario: A site where both variants return 200 status.
Fails because:
- Both
/blogand/blog/return content - No redirect is in place
- Search engines may see duplicate content
https://example.com/blog → 200 OK
https://example.com/blog/ → 200 OKCorrected version:
https://example.com/blog → 301 → https://example.com/blog/
https://example.com/blog/ → 200 OKExample 3: Canonical tag misalignment
Scenario: Canonical tag doesn’t match the preferred format.
Fails because:
- URL redirects to trailing slash version
- But canonical tag points to non-slash version
<!-- URL: /blog redirects to /blog/ -->
<!-- But canonical points to non-slash version -->
<link rel="canonical" href="https://example.com/blog" />Corrected version:
<link rel="canonical" href="https://example.com/blog/" />Unit Test
Test File
xeopix-crawling-v2/__tests__/seo-audit-checks/crawlBehaviour/issue-16-trailing-slash-consistency.test.js
Purpose
This unit test validates that the checkTrailingSlashConsistency() function correctly detects inconsistent trailing-slash conventions across site URLs, reporting issues for URLs that deviate from the dominant convention.
Tested Function
checkTrailingSlashConsistency() from seo-audit-checks.js
Issue Information
- Issue Number: 16
- Issue Code:
TRAILING_SLASH_CONSISTENCY - Toggle Group:
crawlBehaviour
Test Scenarios
Positive Test Cases
- All URLs use a consistent trailing-slash convention (all with trailing slash) → no inconsistency, no issues
Negative Test Cases
- URLs mix slash and no-slash conventions (
/about/vs/blog) →hasInconsistencyis true, 2 issues created with appropriate URLs
Boundary Cases
None
Edge Cases
- Site root only (
https://example.com/) → ignored, no inconsistency detected, no issues
Expected Outcome
Pass
A TRAILING_SLASH_CONSISTENCY issue is not reported when all URLs follow the same trailing-slash convention (or only the site root is present).
Fail
A TRAILING_SLASH_CONSISTENCY issue is reported for each URL that deviates from the dominant trailing-slash convention.
Validation
- Verifies consistent URLs produce no issues
- Validates mixed conventions produce individual issues per URL
- Checks that the site root is excluded from the slash consistency check
- Validates payload structure (
hasInconsistency,details.url)
Related Production Files
xeopix-crawling-v2/seo-audit-checks.jsxeopix-crawling-v2/issueCodes.js
Coverage Summary
- 3 test cases (positive, negative, and edge case)
- Covers consistent, mixed, and root-only URL scenarios
- Validates per-URL issue generation for inconsistent URLs
- Verifies site root exclusion from the check
References
- Consolidate duplicate URLs — Google Search Central
- URI Generic Syntax — RFC 3986
- URL API — MDN