Trailing Slash Canonical 301 Rule Enforcer (Apache, Nginx & Next.js).
Eliminate duplicate /page vs. /page/ indexation splits with file-safe Apache .htaccess, Nginx and Next.js rules that never break .xml or .pdf assets.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]rewrite ^/(.*)/$ /$1 permanent;How to use this in your SEO workflow
- Align your internal <a href> links, XML sitemap URLs and canonical tags with your chosen trailing-slash policy to avoid internal 301 hops.
- Always exclude paths containing file extensions (.xml, .txt, .pdf, .webp) when adding trailing slashes.
- Keep homepage root / untouched when stripping trailing slashes.
Related in-depth SEO guides
Strategy
Map Every Traffic-Bearing Old Address Before Launch Day
Build a complete old-URL inventory from Search Console, Backlinks and Top Pages so zero organic equity gets stranded on launch day.
Data readingResolve Ambiguous and Shared Destinations Manually
Why Serpo leaves ambiguous slugs unmatched instead of guessing—and how to review shared destinations safely.