404/302 Errors in Genesis

Community Forums Forums General Discussion 404/302 Errors in Genesis

This topic is: not resolved

This topic contains 7 replies, has 2 voices, and was last updated by  Summer 9 months, 2 weeks ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #72112

    AOD
    Member
    Post count: 11

    Hi

    In my Associate child theme I have created a new 404.php which is a simple redirect to my desired ‘pretty’ 404 page at http://www.treforestvets.com/404-page

    Testing this in Google shows me that I am actually soft redirecting (302) to this page, instead of returning a proper 404 code. See quote for test fetch as google http://www.treforestvets.com/gfgfgf :

    HTTP/1.1 302 Moved Temporarily
    Date: Sun, 10 Nov 2013 20:49:40 GMT
    Server: Apache/2.2.3 (CentOS)
    X-Powered-By: PHP/5.2.17
    X-Pingback: http://www.treforestvets.com/xmlrpc.php
    Expires: Wed, 11 Jan 1984 05:00:00 GMT
    Cache-Control: no-cache, must-revalidate, max-age=0
    Pragma: no-cache
    Location: http://www.treforestvets.com/404-page
    Content-Length: 0
    Keep-Alive: timeout=15, max=100
    Connection: Keep-Alive
    Content-Type: text/html; charset=UTF-8

    How do I fix this and return a proper 404 code and then go to my chosen page? Do I need to use .htaccess and add document 404?

    My 404.php file code is simply:

    <?php
    header(“Location: http://www.treforestvets.com/404-page“);
    ?>

    Cheers

    #72113

    Summer
    Participant
    Post count: 1009

    That is, in effect, a soft redirect.

    It’s better to make your pretty 404 page content be the content that’s in the 404.php template. Or use the Genesis 404 page plugin :)


    #72114

    AOD
    Member
    Post count: 11

    Thanks, I tried the Genesis 404 page plugin and couldn’t get it working. I didn’t try very hard though, I may give it another go.

    I’m afraid i’m not good enough with php to put my user-friendly 404 page into 404.php. I made a copy of the default genesis 404 in my child theme and edited it but broke the whole website :(

    #72115

    Summer
    Participant
    Post count: 1009

    When you copied the default 404.php to your child theme, did it work before you started editing it? If so, I’d try adding little bits of your HTML at a time, and then figure out which bit of code you added actually did the breaking.

    You might just have a problem echoing out the HTML content you want in between the PHP functions of the rest of the template.


    #72123

    AOD
    Member
    Post count: 11

    yes, it worked fine. Unfortunately I don’t understand .php well enough (i.e. at all!) to make it use a normal ‘page’ template and then edit it from there. I don’t understand what an echo is ;)

    I’ll give the 404 plugin another go

    #72124

    AOD
    Member
    Post count: 11

    I’ve reactivated the 404 pages plugin and it works to a point. I’ve remembered now what the main problem was:

    using the 404 plugin, it upsets the layout of that page as compared to a standard page

    Check the footer here: http://www.treforestvets.com/gggg (obv a nonexistent page)
    and here: http://www.treforestvets.com/about-us

    #72127

    AOD
    Member
    Post count: 11

    Got it sorted now. I think it was something idiotic like me missing a </div> that was causing the footer to break. Hooray, I don’t have to learn .php :)

    #72134

    Summer
    Participant
    Post count: 1009
Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.