gnahotelsolutions/laravel-trailing-slash
Laravel middleware that normalizes trailing slashes on incoming URLs, redirecting requests to your preferred format (with or without a trailing slash) through configurable, SEO-friendly redirects. Easy to install and customize for cleaner, consistent routes.
.htaccess rules./pricing and /pricing/ from being indexed as two pages, consolidating link equity and avoiding duplicate-content signals — a measurable, if indirect, lever on organic acquisition.1.4.0...1.5.0 diff is read; empty notes are not the same as an empty diff.Consider adopting when:
Look elsewhere when:
POST /orders/ will drop the body or get rewritten to GET by clients. You need explicit canonical routing, not redirects.For executives (one paragraph): This is a small, low-cost hygiene fix for our public URLs. Right now the same page can be reached with and without a trailing slash, which search engines may treat as two pages and split our ranking signal. A single middleware redirects one variant to the other permanently, so every inbound link — including old ones from before our last migration — lands on one canonical address. Cost is a composer dependency and a config file; risk is low and the change is reversible by removing one line of middleware registration.
For engineering (the practical case): One middleware, config-driven, no database or schema impact, no service provider magic beyond registration. It handles the redirect and path exclusions, and lets us stop hardcoding URL shapes into route files. Before merging: (1) read the 1.4.0...1.5.0 diff — the release body is empty and carries no changelog text, so we verify rather than assume; (2) confirm redirects are restricted to safe methods (GET/HEAD) and that query strings survive; (3) pin the version and add a feature test asserting 301 status and Location header on a representative route; (4) check middleware priority against TrustProxies/ForceHttps so we don't emit canonical URLs with the wrong scheme or host behind a load balancer; (5) exclude health checks, webhooks, and signed-URL endpoints, where a rewritten path breaks signature validation.
Recommendation: Adopt for the marketing site and any server-rendered public surface; explicitly exclude API route groups via the package's exclusion config or by scoping the middleware to the web group. Set the slash policy as a written decision owned by whoever owns SEO, and revisit only if we move normalization to the CDN.
How can I help you explore Laravel packages today?