Often we need to instruct browser that the URL has been moved to
another location. This can be done in PHP by sending proper HTTP
headers with header
function. The very first example in PHP documentation shows
redirect example, however by default this is treated as
temporary redirection. This means that browser will check
this every time, and also crawling bots might index old URL. In
most cases we want to have redirection permanent. To do
this, we need to send 301 HTTP code along with
redirect statement. Also to ensure finishing of script execution,
it is good to add exit instruction.