FAQ
Hello, all.

I'm Trying to figure out how to emit an HTTP redirect instead of content.

Pointers to docs, examples, or which source files to poke at most
appreciated: I see lib/Combust/Redirect.pm, which looks like something I'd
want, but I can't see how to invoke it from a template file.

Search Discussions

  • Ask Bjørn Hansen at Jul 9, 2007 at 6:15 pm

    On Jul 9, 2007, at 10:44, Will Coleda wrote:

    Hello, all.
    I'm Trying to figure out how to emit an HTTP redirect instead of
    content.
    Pointers to docs, examples, or which source files to poke at most
    appreciated: I see lib/Combust/Redirect.pm, which looks like
    something I'd want, but I can't see how to invoke it from a
    template file.
    There are (at least) two ways - you probably want the second one.
    If not, then tell what you are trying to do and we'll figure it out.

    1) In the controller you can return $self->redirect($new_url)
    instead of return OK, $self->evaluate_template("template"). You
    can't do that from the templates (it wouldn't be hard to do; we've
    just never needed it.


    2) If Combust::Redirect is enabled, as it is for most of the sites
    and can be for the rest, then you can setup redirects in
    the .htredirects file - there's an example on the www site:
    http://svn.perl.org/perl.org/docs/live/www/.htredirects

    The syntax is
    regexp target_url options

    options can be "perm", "temp" or "intern" (or shortened or longer
    version of that).

    internal gives an internal redirect (not seen by the user)
    permanent a 301 response
    temporary (the default) a 302 response.


    - ask
  • Will Coleda at Jul 9, 2007 at 7:50 pm
    Ask Bjørn Hansen writes:

    Ah, .htredirects is perfect, and already exists for parrotcode.org; Thanks!
    On Jul 9, 2007, at 10:44, Will Coleda wrote:

    Hello, all.
    I'm Trying to figure out how to emit an HTTP redirect instead of
    content.
    Pointers to docs, examples, or which source files to poke at most
    appreciated: I see lib/Combust/Redirect.pm, which looks like something
    I'd want, but I can't see how to invoke it from a template file.
    There are (at least) two ways - you probably want the second one. If
    not, then tell what you are trying to do and we'll figure it out.

    1) In the controller you can return $self->redirect($new_url) instead of
    return OK, $self->evaluate_template("template"). You can't do that from
    the templates (it wouldn't be hard to do; we've just never needed it.


    2) If Combust::Redirect is enabled, as it is for most of the sites and
    can be for the rest, then you can setup redirects in the .htredirects
    file - there's an example on the www site:
    http://svn.perl.org/perl.org/docs/live/www/.htredirects

    The syntax is
    regexp target_url options

    options can be "perm", "temp" or "intern" (or shortened or longer version
    of that).

    internal gives an internal redirect (not seen by the user)
    permanent a 301 response
    temporary (the default) a 302 response.


    - ask

    --
    http://log.perl.org/ - http://askask.com/ - http://develooper.com/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcombust-users @
categoriesperl
postedJul 9, '07 at 5:47p
activeJul 9, '07 at 7:50p
posts3
users2
websitecombust.develooper.com

2 users in discussion

Will Coleda: 2 posts Ask Bjørn Hansen: 1 post

People

Translate

site design / logo © 2021 Grokbase