Jump to content

Archived

This topic is now archived and is closed to further replies.

WebDev22

Google: Increase in soft 404 errors. How does one create a custom 404 page?

Recommended Posts

Thanks, Jim. I uploaded it to our site, but must be doing something wrong. When I go to our site (http://bit.ly/12uC0Y1) then add an incorrect/non-existent page name to the URL string, I don't get the custom 404 page. Any idea what I might be doing wrong?

Share this post


Link to post
Share on other sites

@@WebDev22 Having a custom 404 page won't solve the problem, although you certainly should have one. The problem is that the code in oscommerce doesn't return a 404 so the page would never be called. You need to install the Header Status Handler addon. For having a 404 pages, as well as many others, the Custom Server Error works well.

Share this post


Link to post
Share on other sites

A "soft" 404 would be a missing page redirected to another (real) page. If you give a wrong product ID or whatever, it appears to be redirecting back to your home page (index.php). If you give a really missing page, such as http://domain.com/zappa, you get the server default 404 page. A custom 404 page would be something like /404.shtml, which allows you to make it look something like your site.

 

A soft 404 isn't going to either the default or custom 404 error page. I'm not sure what Google told you, unless they're saying that they'd prefer to see bad pages deliver a real 404 error and not get redirected to another page.

Share this post


Link to post
Share on other sites

@@MrPhil If you delete a product and then try to visit the product page with the ID of the deleted product, the product info page still loads. It just says the product can't be found but it returns a 301 or 302. This is the usual cause of the soft 404's from google. They are expecting either a 404 or 410 status on such products.

Share this post


Link to post
Share on other sites

Haven't I seen somewhere an add-on to take a no-longer existing product ID and return a 404 code, either at index.php home page or an error document-type page (e.g., "product not found" product page)? As it works now, it's apparently redirecting to index.php with a 301 or 302, or even just a 200. I could see that being a problem with duplicate content, from Google's POV. I don't see why you couldn't return a 404 or 410 code while ending up at index.php (home page), which should prevent its being duplicate indexed.

Share this post


Link to post
Share on other sites

The Header Status Handler I mentioned does that. If you redirect to the home page that would be fine for the search engines but people may have old url's too. So if a former customer clicks on a url that is for a deleted product, they should be told why it didn't show up. Besides, all sites should have 404 pages. If a search engine or visitor visits an invalid url, even if it is by accident by the people, the server first checks for a private 404 page and if it can't be found, loads the default one. That can amount to a lot of extra bandwidth usage and server load over the course of a month on a busy site. Not really anything to be concerned with by itself but is just another one of those things that slows a site down.

Share this post


Link to post
Share on other sites

Keep in mind that a discontinued product ID isn't going to trigger a normal 404 page. A 404 error document will only be triggered if a requested directory or page is not found. If you get to index.php or whatever with a bad product_id, it won't trigger a 404 page. osC needs to handle that itself, by taking whatever action the programmer thought appropriate. If Google is complaining that this is leading to duplicate pages or whatever, perhaps osC is going to some page with a 301, 302, or 200 code, when it should be giving a 404 code. I can't swear that's the proper way, as I wouldn't want index.php itself to be marked as "not found" and dropped from the SE index.

 

Certainly, there should be some message from osC telling the user why they ended up on a different page than expected. How that will interact with search engines is an interesting question.

Share this post


Link to post
Share on other sites

The issue may be clouded due to they dynamic nature of the products page. But if you try to go to an invalid product, if the product isn't found, then a 404 should be issued since it was not found. The product_info file was found but not the page for that product.

 

The 404 isn't issued for the page being redirected to so if you redirect to index.php that page won't be hurt. Let's say you had a product with and id of 123 and then deleted it. Google is saying (paraphrasing here), "we have this link to product 123 but when we go there your code is telling us to go somewhere else. We expect it to be a 404 or 410, depending upon if you plan on bringing it back or not." They don't want to be redirected since it is more work for them.

Share this post


Link to post
Share on other sites

what is best option for this?

 

do you install both "header status handler" and this one http://addons.oscommerce.com/info/5863 ?

 

 

i would like to have a 404 page also if someone types in a wrong url or page which doesn't exist,

and would also like them to be redirected or informed if they enter a page who's product id is incorect or now deleted.

 

what other plugins should i need apart from those two?

 

thanks

Share this post


Link to post
Share on other sites

For issuing the 404's for deleted or disabled products, categories and manufacturers, use the Header Status Handler. For the actual 404 page, you can install that addon, the code Jim mentioned or just upload a 404.shtml file, edited as you like. The addon I mentioned has the advantage of being part of the shop and handling other errors too.

Share this post


Link to post
Share on other sites

if you try to go to an invalid product, if the product isn't found, then a 404 should be issued since it was not found. The product_info file was found but not the page for that product.

The point is, an invalid product does not trigger a server 404, since the file (product_info.php or whatever) was found. osC has to do some special operations to return a 404 or 410 while going to some other page. It can be done, but is not automatic. osC has to be explicitly coded to do this.

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Just to chime in as an alternative,

 

For a product that no longer exists, I still show the product detail in a greyed out manner without pricing, and then list other products ie alternatives from the same category. (under the product_info.php?products_id=1234 page ...

I'd rather show them good alternatives, then a redirect to the homepage where they might get lost unable to find the product again..

As far as google is concerned, the old product is still a valid page.

We have a fair amount of service products for products that are no longer sold, so this works quite well.


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites

×