This is just a bit of code for my own personal reference:

header('HTTP/1.1 301 Moved Permanently');
header('Location: '.URL);
header('Connection: close');