Timed redirect in kirby?

Dear community,

for my error page I’d like to set up a timed redirect to my home page … is this possible with some kirby code? Couldn’t make it up, only with searching the interweb and plain php. Though I guess the first line is still failing. : /

<?php $url = echo url() ?>
<?php header("Refresh: 5; URL={$url}", FALSE, 308); ?>

Something like this (pseudo code) could be great:

<?php go(url(), 308, 5); ?>

‘5’ meaning 5 seconds in this case.

Do not use echo() to assign a value to a variable.

<?php 
$url =  url();
header("Refresh: 5; URL=$url", FALSE, 308); 
?>
1 Like

Ah, there’s the problem! Then even using url() directly in the header-line works.

<?php header("Refresh: 5; URL=" . url(), TRUE or FALSE, 308); ?>

Thank you again, @texnixe!