I have been googling for this but no one appears to have the answer.
This post describes the problem well:
http://www.mail-archive.com/php-general@lists.php.net/
I don't have PHP here to test this, but wouldn't this produce a 301?
header('Location: http://www.example.com/', true, 301);