Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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...


www.jasonkohles.com
We're not surrounded, we're in a target-rich environment!


Comment on Re: Catalyst - Add Trailing Slashes to URLs
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (12)
As of 2015-07-02 14:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (41 votes), past polls