Wrong Custom 404 Page Displaying

EDIT THIS DOES NOT WORK CORRECTLY
See here

@cynthia, @manofdogz, @Turtle

I almost hate to bring this topic back up again but… :slight_smile:

Although the solution does serve up a custom 404 error page, in the eyes of Google it is returning a 200 not a 404. The reason being (I believe) is that it is returning the response from the actual custom 404 page not the page that caused the 404. Google doesn’t like this…

You can see the server result codes from your non existent page HERE Just enter a bad url EX: http://myurl/bad-page

Doing some research I discovered that you can not change the server response code from a static html page…
So it needs to be a .php page, but… you can’t just change the name, you have to declare it as a php page in the very first line. I can’t find a way to do this in RW.

  • This stuff makes my head hurt LOL

Anyway, I think i have found a solution
1. in RW rename the custom error page to .php (Ialso used the note stack to add a note to the page to remind me NEVER to publish it through RW and the details why - my old brain forgets things) After I was finished I also set the page to draft just to be sure.
2. export the page
3. edit the source and add the following 2 lines to the very top of the page.

<?php header("HTTP/1.1 404 Not Found"); ?> <?php header("Status: 404 Not Found"); ?>

4. upload the new custom error php page
5. delete the current custom error .html page
6. IMPORTANT - don’t forget to modify your .htaccess and change the error page file name to .php version

7. Now go back to the link above and check another bad page - you should see that it is now returning 404 to Google

Disclaimer
I have no idea if this is the “proper” way to do things, it could very well be classified as a junk hack

Good Luck,
Scott

2 Likes