Open mrunkel opened 6 years ago
Here is fine! Could you provide your redirects list, the error message with the rendered page, and/or some details on your server configuration? As for the code, it is using the Kirby toolkit header::redirect()
function: https://github.com/getkirby/toolkit/blob/master/lib/header.php#L242-L255
Since the $send value is kept at the default value of true
in the plugin, it should be setting the headers and then exiting.
I do want to note that using the redirecty()
function at the top of a template/header snippet is a convention that survived from some previous versions of redirection solutions. It shouldn't be an issue to use it earlier (before controller logic, etc). That part of the documentation could probably use some updates.
Right now, kirby keeps running after the call to redirectty(). This means that if there is a redirect found, the old page is completely generated before the redirect takes place.
We discovered this because we had error logging set up on our error page and it would trigger even through there was a redirect in place (that worked). This caused some head scratching until I fired up a debugger.
One way to avoid this would be if the redirectty() function stopped processing on a redirect. I haven't read through the code to see if that's possible.
The other option would be to return true if redirectty caused a redirect to take place. We could then end processing at that point.
I'm curious as to your thoughts. If you'd rather I post this over in the kirby forums instead of here in an issue, I'm happy to do that.
Enough bitching.. Thanks for the plugin, it saved me from having to write my own!