Proper redirecting in TYPO3 (from within PHP)

Redirecting in PHP is easy:

$url = "http://coding-journal.com/";
header("Location: $url");

But there is tons of stuff to worry about when doing a header redirect, for instance:

  • What HTTP status will be sent?
  • Is the URL I’m throwing into the header-call really absolute?
  • Does my script exit after the header-call? (Because there should be no HTTP body if you send a Location: ... header and sending one may lead to unexpected behavior in some browsers).

    Continue reading