Wrong Custom 404 Page Displaying

Hello,

Recently, I made two major changes to my website. I basically made a whole new site as an updated version of the old one. A few days later, I also changed webhosts. Just before changing webhosts, I tried to make a new custom 404 page. A long story short, I was having some difficulty, and tried it several times. After switching webhosts, I believe I created a successful custom 404 page. It is named 404.shtml in the root of my new site. If I go to my current site online, and type in an incorrect page URL, I believe the new 404 page is working just fine. When I recreated my site, I dropped a lot of old pages because I am making some updated content. Anyway, when I do a Google search for my site, some of the old (obsolete) pages are still showing up. When I click on one of those, Iā€™m getting a weird looking 404 page, and not the current one I have on my site. The weird one that comes up looks similar to one I tried to create at the old hosting. It also looks like the CSS or something is not applied, so it looks distorted. Recently, I cancelled my old webhost, I have the domains pointing to the new hosting, and I have created and submitted a new sitemap.xml file to Google several times which is at the root of my site. The URL for my site is http://www.educationoasis.com. Is there a way to stop the obsolete 404 page from displaying, and instead use my new one? I donā€™t know if this is a RW thing, or Google, or if itā€™s in a cache somewhere, or what. My new webhost says it doesnā€™t have anything to do specifically with their servers. Any help would be truly appreciated!!

2 Likes

Do you have a RapidWeaver Community Subscription?

They cover this in the advanced tutorialsā€¦ $10/month for Silver, pay month to month cancel anytimeā€¦

Brad

No, I donā€™t have a paid subscription to the RW Community right now. I think I will look into that. I think I finally figured out (or sort of) how to solve the wrong 404 page from displaying, although I really donā€™t understand it. I changed the folder and filename to one I had tried to create at the old hosting site, and now it seems to pull it up correctly. The only problem is, it still doesnā€™t let me completely lay it out the way I want. For example, it doesnā€™t include an image, just a placeholder for it, and some of the text is crunched together. When I try to adjust it with margins and/or padding, it doesnā€™t change at all, and still looks the same on the page. It changes in Preview, but the published page doesnā€™t change. Oh well, I guess Iā€™ll keep working with it the best I can. At least the page is displaying now. Thanks for your help and the info! I will check out the RW Community.

Cynthia - You might find this useful: http://www.marathia.com/blog/index.php?id=3277479349107382808

Personally I donā€™t use custom 404 pages as it encourages me to make sure my 301 redirects are good but probably should as itā€™s a good fallback

on a different subject - Iā€™m looking at some sticky / slide out type navigation and wondered what you used for the left side nav bar on your site? Particularly like the fact users can close and the lightbox effect.

@manofdogz If you use Foundation, thereā€™s an ā€˜Off Canvasā€™ stack that does this. Though Iā€™m not very familiar with implementing it.

I have made some redirects, but I have so many obsolete pages that are still showing up in a Google search that I thought it would be best to use the 404 as well. I will check out the marathia blog - thanks!

If Iā€™m understanding what part youā€™re asking about correctly, I used the AddThis menu link on the left side of the pages.

Iā€™ve never used Foundation, but that sounds good. Thanks for letting me know!

Thanks for this - I didnā€™t move to Foundation at the time as wanted to hold onto IE8 support for a bit longer (you get this with freestacks - which I like a lot). Iā€™m a big fan of JW thoā€™ so will def give foundation a shot for some future products.

Youā€™re welcome! I may try Foundation in the future myself. I also like Joe Workman, and have his book, RW5, and quite a few of his stacks. I love his Elevator stack, which Iā€™m currently using on my site. Thanks!

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

great that you have brought it back up - this is an easily missed error obviously! Will take a good look at this but thanks very much

2 Likes

Thanks for that Scott! I got the .htaccess solution working on a site that just went live, and your clear instructions are very helpful.

Dave

2 Likes

Thanks Scott for the thorough explanationā€¦ bookmarked for future reference :wink:

Brad

1 Like

hi Scott,

I canā€™t believe weā€™re at it again! :confused: But seriously, I am so thankful for you working on this so hard again, and for all your help!!

I hope I did everything correctly; I tried to follow your directions, which are very good. There was something on the top of the new page about the doctype HTML, I canā€™t remember exactly, so I deleted that and added the two lines of text that you gave me. Iā€™m not sure how to edit pages outside of RW, but I tried to do it with TextWrangler, and then uploaded it with Transmit. I wish we could edit HTML in DW. I also wish it would let you put something in the main navigation menu bar without creating a page for it.

Anyway, Iā€™m not completely sure, but I think itā€™s working when I try it at that link thingee that you provided. I noticed when Iā€™m in Google Analytics, there seems to be a lot of activity with the 404 page (before I just did what you said). I donā€™t know if thatā€™s normal or not. I thought it was because I made the new site, and I guess Google still shows a lot of old pages out there that are not included in the new site. Or maybe itā€™s related to the problem that you discovered now, I donā€™t know enough about this stuff to know the answer.

The only issue (that I know of now) is that the 404.php page isnā€™t all formatting correctly again. At least it basically looks like it should, only it no longer has the colors on the page and menu color etc. to match the other pages on the site. I think that may be a CSS thing or something, but I donā€™t know how to fix it, if it can even be fixed.

Thank you so very much for looking into this further for me! Hopefully this will help to make things show-up correctly. Thanks again!! :slight_smile:

@cynthia,
Nothing should have changed as far as the look of your page so if it did then something may be amissā€¦ That line you deleted, prob should have left that in there just add the two php lines above it.

You can edit the page in text wrangler, text edit any plain text editor will do.

Do you use google webmaster tools? If not you should sign up for it. With that you can see how Google crawls and indexes your site and also if you have site errors. Thatā€™s how I discovered the 404 problems I had a load of ā€œsoft 404ā€™sā€ which basically means that the page wasnā€™t found but no 404 was sent to google.

If your site was a redo of an old site or you moved it, did you do the 301 redirects from your old content urls to the new urls? That will save a lot of 404s and help keep the old page rank.

Looks like your php 404 page is loading, what is wrong?

Oh, forgot to ask, what is it you want to add to the menu, if you explain, there may be a way. Remind me, are you using foundation theme?

Unfortunately, the page no longer seems to have all the formatting that it had before; mainly the colors of the theme, background, menu colors, etc. When I get home tonight, I will try to re-add that HTML line back in as you said and see what happens.

I do use Google Webmaster Tools, but Iā€™m still trying to learn how to use it. I did see a soft 404 error in there. I read some of the Google help about it, but I still donā€™t understand it all, and so I donā€™t know exactly what it means or how to fix it. When you had a lot of soft 404s, were you checking for them on my site somehow? Iā€™m not sure what you meant.

This is a rebuild of an earlier version of the site. I did a lot of 301s for the main pages, but didnā€™t do most of them because there are literally hundreds of old pages that I wasnā€™t going to use again on the new site.

I will try to work with it some more tonight when Iā€™m at my website computer. Thank You!

I am not using the Foundation theme. I am using the Copper theme by SeyDesign. I was wanting to possibly be able to add a placeholder or something in the menu that really wasnā€™t a page. For example, in the menu, I have Printables, and below that, All Printables. Currently, the All Printables page is a duplicate of the Printables page, that way whichever someone clicks, they will get the same information. I would like it if Printables wasnā€™t a real page, and just a header for the menu items below, and then only the All Printables would be the real page. Anyway, if I explained that right, thatā€™s what I was thinking about trying to do. Thanks!