[Grok-dev] How do I do a 301 Permanent Redirect?
sebastian at urbantalk.se
Sun Jan 25 03:52:51 EST 2009
Many thanks! This works like a charm.
25 jan 2009 kl. 02.42 skrev Uli Fouquet:
> Hi there,
> Sebastian Ware wrote:
>> The self.redirect(url) method on a view allways performs a "303 See
>> Other" redirect, but if I want to send a "301 Permanent Redirect",
>> do I do this?
>> I have tried this
>> self.response.setStatus(301, "Permanent redirect")
>> self.redirect("%s" % self.url(o, 'index'))
>> But the setStatus doesn't seem to have any effect.
> I assume that redirect sets the status code to 303. How should it
> otherwise initiate a redirect? So your status setting has no effect.
> You might try this:
> self.response.setStatus(301, 'Moved Permanently')
> self.response.setHeader('Location', self.url(o, 'index'))
> Maybe that helps.
> Best regards,
More information about the Grok-dev