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:’); ?>

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…

I’ve had this happen when dealing with domain transfers.

Removing the unicode signature (BOM) does the trick. To accomplish this from Dreamweaver, simply

  • Right click on the tab of the file you have open
  • Select Save as
  • From there, uncheckĀ Include Unicode Signature (BOM)
  • Then save the file, over-writing your original, if you’d like (always have a backup when fudgin’ with files).


  • Copy your code from the original file…
  • Paste it in to a new document
  • Close the original
  • Then save the ‘new’ file over the old one

Have you encountered any similar incidents?