Edit this topic

Prevent trailing slash route handler

: shell

: prevent-trailing-slash

: middleware

: /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


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.

Kind: global variable

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.

Kind: static method of PreventTrailingSlashRouteHandler

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