Edit this topic

Prevent trailing slash route handler

: shell

: middleware

: prevent-trailing-slash

: /modules/core/routing/services/prevent-trailing-slash-route-handler.js

: https://github.com/DecentCMS/DecentCMS/blob/master/modules/core/routing/services/prevent-trailing-slash-route-handler.js

PreventTrailingSlashRouteHandler

This handler registers itself as an Express middleware that permanently redirects all requests with a trailing slash. This ensures that content items have a single URL.

PreventTrailingSlashRouteHandler.register(scope, context)

Registers a middleware that will permanently redirect requests for URLs ending with a slash to the same URL without the trailing slash.

Param Type Description
scope object The scope.
context object The context.
context.expressApp object The Express application object.