I'm trying to use Slim Framework's redirect, however it isn't working at all. Here is an example:
// Viewing a note
$app->get('/n/:id(/:password)', function ($id, $password = null) use ($app, $tl, $settings){
// User has requested a note
$note = $tl->load($id);
// Check if note is valid
if ($note) {
// No problems, note is valid
$app->render('note.php', ['note' => $note, 'settings' => $settings, 'password' => $password]);
} else {
// Note has been deleted or doesn't exist, render error
$app->flash('error', '<p>The requested note doesn\'t exist. It may have expired or been deleted.</p>');
$app->redirect('/');
}
});
// Get posted password
$app->post('/n/:id', function ($id) use ($app) {
// Hash password, redirect user back to note
$app->redirect('/n/' . $id . '/' . SHA1($app->request->post('password')));
});
When I submit the form on the previous page, it posts to /n/:id, but then simply displays a blank page. The same goes for the homepage redirect in the ifelse statement. If I open the Chrome developer tools, I can see that the status of the request is 200, and the method is POST. Adding an error_log to the request handler shows me that the request is made, but the redirect does nothing. I've enabled all error reporting, but nothing is shown.
It was working literally hours ago, so I have no idea what's wrong with it. Any thoughts?