perl - catalyst consistent url format with trailing slash -
i'm developing catalyst application , having problem way catalyst
interprets urls.
let's in our catalyst application have controller account
. if case, catalyst interpret
http://mydomain.com/account
, http://mydomain.com/account/
as same url index action.
however, seo , linking purposes (and consistent overall) forcefulness catalyst recognize 1 format , stick it.
i've found 1 module seems built this: catalyst::plugin::sanitizeurl, it's documentation says should set
use catalyst 'sanitizeurl';
in myapp.pm
, handle you.
however, whenever utilize error:
bad request
on every page load. know of simple way have catalyst utilize 1 format?
the simple way forcefulness catalyst utilize 1 format without trailing slash add together method myapp.pm:
sub begin :private { ($self, $c) = @_; @path = split "/", $c->req->path, -1; $c->detach('default') if @path , (pop @path eq ''); }
it redirect on 'default' method a.k.a page 404 if uri ends slash on request.
perl url catalyst trailing-slash
No comments:
Post a Comment