[Catalyst] rewrite request
Anton Katsarov
anton.katsarov at pixel-bg.com
Tue Nov 27 15:45:56 GMT 2007
Hello,
I am trying to rewrite the requested uri in order to remove the first
argument. For example:if I request http://localhost:3000/blog it calls
MyApp::C::Blog::index
I want the requested uri http://localhost:3000/bg/blog also to call the
same controller.
In other words I just want to remove the /bg/ at the beginning.
I tried this:
sub default : Private {
my ( $self, $c ) = @_;
if ($c->req->path =~ m/^(bg)\/?/i) {
$c->req->path =~ m/^(bg)\/?(.*)$/i;
my $rest_uri = $2;
$c->detach('/' .$rest_uri . '/index');
}
}
But it works only if the component has index.
I need some way to build the action from the modified string of the
requested uri.
Thanks in advance.
Best regards,
Anton Katsarov
More information about the Catalyst
mailing list