Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Catalyst - Add Trailing Slashes to URLs

by jasonk (Parson)
on Dec 04, 2008 at 04:45 UTC ( #727868=note: print w/replies, xml ) Need Help??

in reply to Catalyst - Add Trailing Slashes to URLs

package MyApp::Controller::Root; use strict; use warnings; use parent 'Catalyst::Controller'; __PACKAGE__->config->{ 'namespace' } = ''; sub auto : Private { my ( $self, $c ) = @_; if ( $c->request->path !~ m{/$} ) { $c->response->redirect( $c->request->path.'/' ); return 0; } return 1; }

I could have sworn there was a plugin out there to do this, but I can't seem to find it now...
We're not surrounded, we're in a target-rich environment!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://727868]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2016-10-28 07:58 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (377 votes). Check out past polls.