Community Forums › Forums › Archived Forums › General Discussion › 404/302 Errors in Genesis
- This topic has 7 replies, 2 voices, and was last updated 10 years, 5 months ago by Summer.
-
AuthorPosts
-
November 10, 2013 at 2:57 pm #72112AODMember
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-8How 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
November 10, 2013 at 3:08 pm #72113SummerMemberThat 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 🙂
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After DarkNovember 10, 2013 at 3:14 pm #72114AODMemberThanks, 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 🙁
November 10, 2013 at 3:21 pm #72115SummerMemberWhen 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.
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After DarkNovember 10, 2013 at 3:53 pm #72123AODMemberyes, 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
November 10, 2013 at 3:57 pm #72124AODMemberI'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-usNovember 10, 2013 at 4:12 pm #72127AODMemberGot 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 🙂
November 10, 2013 at 4:32 pm #72134SummerMemberLOL! Glad you got it figured out 🙂
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After Dark -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.