• Quick Fix: Warning: Cannot modify header information – headers already sent by …

    I was recently asked to do an SEO review of a website which is experiencing some issues with a drop in exposure for keywords they would once rank well for (all SEOs are rolling their eyes since we hear this all the time) and was interested in finding that a recent update to the code was one of their issues.

    A modification to the index file to add some ‘google tracking’ was the cause… it was pasted to the top of the document before the PHP opening tags and because the page was requesting the header(“Location: later in the script it would cause an error because information was already being sent to the client.

    To prove this: simply view source of the page you are getting this error with. You will find the code that is causing the problem.

    This error is actually saying that something is preceding this php header function. When I would view the source code from the page which was displaying this information it was showing the google adwords tracking code.

    The easy fix for this is to place the same code at the end of the document outside of the php tags after the header info has a chance to display.

    head’s up people… Be sure to add your code in the appropriate areas… and if the ‘marketing people’ are adding code to the site, make sure it’s done properly (or even better yet, if you don’t like code, use a good plugin for the tracking code 🙂

    Hope this helps.

    Paul

  • The topic ‘pluggable Warning: Cannot modify header information – headers already sent by’ is closed to new replies.