Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Trailing Slash Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Canonical URL policy: Settles the trailing-slash-vs-no-trailing-slash question (a per-site SEO decision, not a per-developer one) and enforces it with a single middleware rather than scattered route definitions or ad-hoc .htaccess rules.
  • SEO / crawl-budget hygiene: Prevents /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.
  • Legacy migration workstreams: When replacing an older site or absorbing inbound links from a previous platform with inconsistent URL patterns, this is the cheap way to normalize traffic instead of writing redirect maps by hand.
  • Build vs. buy: A ~1-file middleware is easy to hand-roll, so the build-vs-buy call hinges on maintenance tolerance rather than capability. Adopting the package buys config conventions, path exclusions, and (presumably) query-string preservation for free.
  • Release posture for 1.5.0: A minor semver bump with an empty release body (changelog link only). No announced features, deprecations, or breaking changes — treat as a routine dependency refresh, but do not sign off on it until the 1.4.0...1.5.0 diff is read; empty notes are not the same as an empty diff.

When to Consider This Package

Consider adopting when:

  • You operate a public, indexable website where canonical URLs matter and route definitions are inconsistent across teams or legacy code.
  • You have inbound links or historical sitemaps using the other slash convention and want a single controlled 301 layer.
  • You want the policy expressed in config (excluded paths, prefix rules) rather than baked into server config you don't own — e.g. platform-as-a-service hosting without nginx access.
  • You are consolidating a handful of Laravel apps and want one identical URL-normalization behavior across all of them.

Look elsewhere when:

  • The app is API-only. Redirecting non-GET requests is semantically wrong; a 301 on POST /orders/ will drop the body or get rewritten to GET by clients. You need explicit canonical routing, not redirects.
  • Edge/CDN already normalizes URLs (Cloudflare rules, Fastly, ALB rules). Adding middleware creates two sources of truth and an extra hop.
  • You need more than slash handling — locale prefixes, case normalization, www/non-www, extension stripping. A single-purpose package becomes one of five middlewares fighting for ordering; a reverse-proxy rewrite layer is the better tool.
  • You need guarantees on high-traffic paths. Redirect chains and middleware-ordering interactions deserve an owned, tested implementation when a misconfigured rule costs revenue.

How to Pitch It (Stakeholders)

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.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib