Tag: bom

PHP Header not working due to Unicode Signature (BOM)

I was editing a site for a customer in Dreamweaver CS5.5, and I was redirecting an old page to a new version via PHP (though a 301 is the proper method, but that’s another post):

<? header(‘location: newurl.com/goes-here’); ?>

Simple enough? Nothing before or after. Certainly no spaces. These were the only characters in the entire file.

Except, upon checking out the page, I received an error:

Warning: Cannot modify header information – headers already sent by (output started at /home/www/redirect.php:1) in /home/www/redirect.php on line 1

Hmm. But there isn’t anything else on that line…