• Resolved johanna2patricia

    (@johanna2patricia)


    Hi everybody,
    I have a weird problem.
    I have a static website and I have a WP blog. The WP blog is located in a subfolder on that static website.
    In my error logs on my server I get this:

    Cannot modify header information - headers already sent by (output started at .... /public_html/index.php:1) in .... public_html/blog/wp-includes/pluggable.php on line 1216\n

    The index.php is from the static website and on line 1 there is only the doctype without whitespaces.
    So why do I get this error, and I get it for all my static websites pages?
    And how can I get rid of it?

    Johanna

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Your static pages should not be invoking the WP environment, which is the only reason pluggable.php should be processed, causing the header error. By the same token, WP requests should not be invoking files outside of its folder structure, such as public_html/index.php. Determine why there is cross referencing going on and you will solve the problem. I’d start by looking at .htaccess files of both /public_html/ and /blog/ for possibly erroneous redirects or similar.

    Then look at any common PHP files used by your static pages besides index.php for possible causes of inappropriate WP references.

    Thread Starter johanna2patricia

    (@johanna2patricia)

    Thanks Bcworkz!
    I managed to solve it with the help from members from a php forum.
    On my static pages I have an include that refers to a php page that gets my latest wp posts. That caused the error.
    I include an ob start code now before the doctype and a print code at the place of the include. It works well.
    I understand that that is a “dirty” solution, but since I have little knowledge of php, it is ok for me.
    Thanks for thinking with me.

    Johanna

    Moderator bcworkz

    (@bcworkz)

    You’re welcome. In the range of dirty hacks, output buffering is pretty tame. It’s often the best solution when directly managing PHP output is problematic.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘“Headers already sent” – Static site and WP Blog?’ is closed to new replies.