301 redirect with go()

I need a 301 redirect instead of the default 302. From a quick inspection of the code I thought I could just pass the desired code like so:

go('where/I/need/to/be', 301)

That doesn’t work though and always sends 302. Is there a way or do I need to edit the toolkit code?

1 Like

I also tried to achieve this, but go() does not seem to have an option for this. So I use

header::redirect($page->parent()->url(), 301);

for my onepager segments. Just as one example.

But it would be nice, if go() has an option for this too.


works like a charm, thanks :slight_smile:

This option is now available natively in Kirby 2.3.2.

1 Like