WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] 410 errors returning 404 pages (3 posts)

  1. Sapphire
    Member
    Posted 3 years ago #

    I think this is a server configuration issue, because it's only happening on one of my hosts, and I haven't found anyone else with the same issue on another host. But I'm asking in here in case someone has seen this behavior before.

    When I set a deleted WordPress post to return a 410 "gone" error, by adding code like this to htaccess:

    "Redirect gone /post-slug-here"

    On most hosts, it returns the Apache 410 page, like it should. But on this one host of mine, it's returning the standard WordPress 404 error page. Which gives the search engines an entirely different message, and not the one I need them to get.

    I trouble-shot this by removing all rules from my htaccess. Then I put back in the 410 rules only, and it went to the Apache "Gone" page like it should. Then I put the standard WordPress rules back in, and it started sending 404s. To me, this suggests that particular server is having a small config clash with WordPress' rules. There must be something in the server config that's not quite right, and once we find that and fix it, all will be well.

    But I'm having enormous trouble getting my host to understand this. Am I wrong about the cause of this issue?

  2. Sapphire
    Member
    Posted 3 years ago #

    Okay, my host says this line is what's causing the problem (because if he comments it out, the 410s work like they should):

    RewriteRule . /index.php [L]

    But that's a standard WP rule that appears in all my sites, and does NOT cause the problem on other servers. And they say their mod_rewrite rules work "similarly" to other servers, so they don't know what to fix, but if I can tell them what to change, they'll try it.

    Time to find a new host? Or does anyone have any idea why that line would be causing this problem on this server but not others I or people I've talked to have checked?

  3. Sapphire
    Member
    Posted 3 years ago #

    Finally convinced my host to dig deeper, and it turns out (according to them) it's an issue with Cpanel builds from 2008 or later.

    The fix is to add this exact line into htaccess:

    ErrorDocument 410 default

    Various versions of that line were recommended elsewhere , and I tried them, and apparently they don't work with newer Cpanel builds, but the above code does.

    I'm marking this as solved.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.