If you are changing your URL structure, for example when moving to a search engine friendly URLs system, you need to be able to let Google and all the other search engines that the page has moved to the new URL. You really don’t want to display the same content on two URLs
So to achieve this we can do what is called a 301 redirect. This is a special redirect message which basically says “has permanently moved to”. By doing this, all of the search engine power, rank or whatever you want to call it will be directly transferred to the new URL.
Sometimes your script might spit out the headers earlier than you expect. If this happens then your site will fail completely to load with a fatal error along the lines of
warning: Cannot modify header information – headers already sent by (output started at .…
Note script tags need spaces removing