Support » Fixing WordPress » 404 headers sent on pages with #anchor

  • Resolved dosa



    I have a variant of

    Seen on WordPress 2.0.5, Apache 1.3.33, PHP 5.1.6, MySQL 5.0.24a
    and on WordPress 2.0.4, Apache 1.3.37, PHP 4.4.4, MySQL 5.0.24.

    All my pages are being served fine & I wouldn’t know of any problem except that I used curl to resolve another issue. I discovered that URLs ending with a page anchor (hope that’s the term) such as #comments are returned with a 404 HTTP header, and the same URL without the #comments is returned as 200 as it should be. The named anchors do exist in the page and are found by the browser.

    I’m using permalinks such as /%year%/%monthnum%/%postname%/

    The sites are on internal servers so can’t pass out eg links, sorry.

    I’d be grateful for any thoughts, thanks.

Viewing 1 replies (of 1 total)
  • Ok, I’ll reply since nobody else has! 😉

    I misreported the problem: when I was getting 404s in curl they were indeed true 404s, with my page-not-found template being returned. The problem seems to lie in how the command line utility curl does its HTTP request:

    If I want URI:

    Browsers seem to just send:

    GET /foo/ HTTP/1.1

    (and deal with the #somewhere internally I presume) whereas Curl sends the full:

    GET /foo/#somewhere HTTP/1.1

    and this confuses wordpress, which can’t then find any posts.

    Confused me too! Grrr.

Viewing 1 replies (of 1 total)
  • The topic ‘404 headers sent on pages with #anchor’ is closed to new replies.