Forums

[resolved] Header error b/c of no www prefix. (19 posts)

  1. Curious11
    Member
    Posted 3 years ago #

    Hello!

    Firstly, thank you very much for looking into this.

    Secondly, my situation is this:

    I have a WP installation in its own sub-dir on my server. I also have the the index.php and .htaccess files moved to the root dir. As you may expect, I did this so that my blog can be accessed by http://www.domain.com or domain.com.

    Now, regardless of whether I choose the blog's domain to have or not have the www domain prefix, whatever the URL is not set to in the settings panel in the Dashboard... will bring up an error.

    For example, if in the WordPress Address box I have: http://www.domain.com/blog and then in the Blog Address box I have http://www.domain.com, going to http://www.domain.com works fine. However, going to domain.com brings up the following error:

    Warning: Cannot modify header information - headers already sent by (output started at /home/content/i/n/d/indecisiveian1/html/index.php:1) in /home/content/i/n/d/indecisiveian1/html/blog/wp-includes/pluggable.php on line 850

    Now, I've looked for any extra spaces in the index.php file... haven't found any. I'm not sure how to rectify this situation.

    Essentially, I would like to have the site accessible at either url, which would mean I need a redirect of some kind. I've tried different approaches with the .htaccess file, but have had the same error pop up, so I reverted it to the default.

    Help! I implore you!

  2. whooami
    Member
    Posted 3 years ago #

    /home/content/i/n/d/indecisiveian1/html/index.php

    you edited that file, right? to change the path to wp-blog-header.php, per the codex?

    you introduced hidden characters or line breaks when you edited it. that you dont "see" them is why theyre called hidden.

    Upload an identically edited index.php, taking care to use a plain text editor, and not some MS word apps to edit it, or just remove the hidden stuff you introduced.

  3. Curious11
    Member
    Posted 3 years ago #

    Yep, right now it's the following:

    <?php
    /**
     * Front to the WordPress application. This file doesn't do anything, but loads
     * wp-blog-header.php which does and tells WordPress to load the theme.
     *
     * @package WordPress
     */
    
    /**
     * Tells WordPress to load the WordPress theme and output it.
     *
     * @var bool
     */
    define('WP_USE_THEMES', true);
    
    /** Loads the WordPress Environment and Template */
    require('./blog/wp-blog-header.php');
    ?>

    I did take care to edit in notepad and save as UTF-8, so I'm not sure that's the issue.

  4. whooami
    Member
    Posted 3 years ago #

    ..so I'm not sure that's the issue.

    clearly then, you dont need the help of anyone with 4 years experience. ill just point you to the documentation.

    http://codex.wordpress.org/Answers-Troubleshooting#Headers_already_sent

    best of luck.

  5. Curious11
    Member
    Posted 3 years ago #

    clearly then, you dont need the help of anyone with 4 years experience. best of luck.

    ? I don't really understand how I offended you, but I do apologize.

    Regardless, thanks for your time!

    EDIT: I did try rewriting in notepad and saving again as per your suggestion, and it didn't change the situation. This is why I said I don't think that's the issue.

    I've also seen that page in the codex and tried it out. Unfortunately, it didn't do the trick either.

  6. whooami
    Member
    Posted 3 years ago #

    im not offended, Im simply telling you that there are limited causes for that error, and the fact that you are editing it, regardless of a redo, supports my remarks.

    put wordpress in its own directory, with an unedited index.php..

    what happens?

  7. Curious11
    Member
    Posted 3 years ago #

    I do realize the point your making. What's frustrating for me is that I've tried the suggestions you and others have made to no avail.

    Let me just iterate what the issue is, so that I'm sure we're on the same page.

    Problem:

    Visiting: http://www.domain.com (works fine).
    Visiting: http://domain.com (produces the error).

  8. whooami
    Member
    Posted 3 years ago #

    Visiting: http://domain.com (produces the error).

    and is that ALL thats seen? does the content display under the error at all?

    whats being returned in the headers? I cant check because you dont want to share the domain, obviously.

    Visiting: http://www.domain.com (works fine).

    the correct content shows up?

  9. Curious11
    Member
    Posted 3 years ago #

    Visiting: http://www.domain.com

    Yep, correct content shows up.

    Visiting: http://domain.com

    Shows the error and only the error on a blank white page.

    Feel free to have a look here.

    Excuse the mess.

  10. whooami
    Member
    Posted 3 years ago #

    ok, and what do you see when you look in firefox?? I assume you arent or you might have mentioned seeing it... I see the hidden char right on that page.

    <html><head></head><body><br />  <---------------
    <b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /home/content/i/n/d/indecisiveian1/html/index.php:1) in <b>/home/content/i/n/d/indecisiveian1/html/blog/wp-includes/pluggable.php</b> on line <b>850</b><br />
    </body></html>
  11. whooami
    Member
    Posted 3 years ago #

    furthermore, its also seen as your page loads at the www. url, youve just cached the content so youre no longer seeing it. I saw it, right as the page loaded.

    I can prove it by directing you here:

    http://www.ianborges.com/feed

    :P

  12. whooami
    Member
    Posted 3 years ago #

    what does this tell me? it tells me that there are hidden characters before the opening <?php in your edited index.php, like I said an hour or so ago :)

    the ONLY other possibility is that its being caused by a plugin file with the same problem, and since we know youve edited the file I keep mentioning ...

  13. Curious11
    Member
    Posted 3 years ago #

    It just doesn't make sense! I've edited the same index.php file, from the original, a variety of times, trying different things, etc. and still the chars?

    I've used jedit as well and there are still hidden chars?!

    I'm going to have another look at it and will take a look at the plugin files as well.

  14. whooami
    Member
    Posted 3 years ago #

    actually, i forgot, its telling you the file in the error, you can skip looking at plugins.

    Btw, if you have shell access you can see the hidden stuff by cat'ing the file:

    # cat index.php

  15. Curious11
    Member
    Posted 3 years ago #

    Thanks for your help, thus far.

    I've inadvertantly caused another problem, thereby causing a headache and a desire to smash.

    For the sake of my notebook, I'm going to let this sit for the night.

  16. whooami
    Member
    Posted 3 years ago #

    Thanks for your help, thus far.

    I've inadvertantly caused another problem, thereby causing a headache and a desire to smash.

    For the sake of my notebook, I'm going to let this sit for the night.

    youre welcome. if you email me the file, Ill fix it for you :)

    whoo at mydomain.com where mydomain.com is actually village-idiot.org

  17. Saurus
    Member
    Posted 3 years ago #

    I don't understand the issue here. If I take the link to your site it loads fine. I see no extraneous characters. If I enter your site name without the www - it just redirects to the correct url as it should.

  18. whooami
    Member
    Posted 3 years ago #

    Its been fixed --

  19. Curious11
    Member
    Posted 3 years ago #

    Ahoy,

    Sorry, been a bit busy and didn't get a chance to update this. Yep, I fixed it.

    whooami, I appreciate the offer, but I wanted to try it out one more time. I used notepad++ this time to edit and it worked.

    Thanks again for your help.

Topic Closed

This topic has been closed to new replies.

About this Topic