This is a standard redirection in PHP:
<?php
header( 'HTTP/1.1 301 Moved Permanently' );
header( 'Location: http://www.example.com' );
exit;
?>
However, in your case the 301 redirection line is probably not necessary. It should be noted that the exit
is necessary, otherwise the rest of your PHP script will be executed, which you may not want (e.g. you may want to display something if there is an error).
Also, the header
function must be called before any output is sent to the browser (including blank lines). If you're unable to avoid some blank lines, put ob_start();
at the start of the script.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…