[cgiapp] can not redirect to upper level url ?

Mark Rajcok mrajcok at gmail.com
Sat Oct 25 00:37:52 EDT 2008


On Tue, Sep 2, 2008 at 10:49 PM, Silent <silent2600 at gmail.com> wrote:

> I use C-A::plugin::Redirect,
> when the app run with URI like "/cgi-bin/app.cgi/news/1024"
> and I want to redirect to "/cgi-bin/app.cgi/home", (for news id 1024 may
> not
> found)
> I use $cap->redirect('../home');          # I always think this will work
> but I only got redirect to "/cgi-bin/app.cgi/news/home",        and this
> will got a endless loop
> could anyone tell me a better method ? not use absolute path or
> CAP::P::Forward
> maybe I need to caculate the new path by $ENV{xxx}


Maybe I'm missing something, but can you simply do this:
  $cap->redirect('/cgi-bin/app.cgi/home')

For "default redirects" like this, I added an entry to my configuration
file:
  main_page    /requests.cgi
And then redirect like so (if using CAP:ConfigAuto):
  $cap->redirect($self->cfg('main_page'));

For you, it would be something like this:
  home_page   /cgi-bin/app.cgi/home

The config file is specific to app.cgi (hence app.cfg).
-- Mark


More information about the cgiapp mailing list