The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Plack::Middleware::TrailingSlash - Append a trailing slash to GET requests whenever it is missing

SYNOPSIS

  builder {
    enable 'TrailingSlash';
  };

DESCRIPTION

Redirect to a path containing the trailing slash if the path looks like a directory

The Catalyst Perl MVC framework matches the requested URL to an action both with and without the trailing slash. For example both /company/contact and /company/contact/ go to the same action and same template.

This module redirects the requests without the trailing slash (ie. /company/contact) to the same URL with the trailing slash added (ie. /company/contact/).

Redirects are done permanently to avoid duplicate content in search indexes, but is given a max age of 3600 to prevent browsers from caching the redirect indefinitely.

PARAMETERS

ignore

A string or an array reference with a list of paths to ignore the trailingslash handling.

  builder {
    enable 'TrailingSlash', ignore => [qr/^\/foobar\//];
  };

  builder {
    enable 'TrailingSlash', ignore => [ qr/^\/foobar\//, qr/^\/lolcat\// ];
  };

SEE ALSO

Plack::Middleware Plack::Middleware::TrailingSlashKiller

AUTHORS

Oskari Ojala <oskari.ojala@frantic.com> Josep Roca

COPYRIGHT

Copyright 2013-2015 - Oskari Ojala

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.