Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Header Status Handler


Jack_mcs

Recommended Posts

If you have a google webmaster account, you will probably have noticed an increase in the number of soft 404 errors. There are several causes for this but one of the main ones is that oscommerce doesn't return the proper status code when a category, manufacturer or product cannot be found. This addon changes the code so that the correct header status is returned.

Edited by Jack_mcs

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

All sites do, or have the potential for it, since oscommerce doesn't return 404 and 410 codes. Though that is only a problem if categories, manufacturers or products have been deleted or made not available.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

You're welcome. :)

 

Any suggestions?

 

 

/**** Begin Header Status Handler by Jack York @ ocommerce-solution.com ****/

if (HSH_ENABLE == 'true') {

if (($category_depth != 'top' || ($category_depth == 'top' && isset($_GET['manufacturers_id'])) )&& ! IsvalidCatOrMan($cPath, $_GET['manufacturers_id'], $languages_id)) {

header("HTTP/1.1 410 Gone");

header("Status: 410 Gone");

printf("<script>window.location='" . HSH_REDIRECT_TO . "'</script>");

exit;

}

}

/**** End Header Status Handler by Jack York @ ocommerce-solution.com ****/

Link to comment
Share on other sites

The error is saying differently. It might be that you have altered code that is causing the problem but there's no way for me to troubleshoot that in a support thread. You'll have to figure out why it can't find the included file or pay someone to troubleshoot it for you.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 1 month later...

Works well, one more tool to keep the Google Gods and maybe even Bing happy.

 

Thanks

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

  • 1 month later...

Hello all,

 

I've also installed the Header Status Handler, but I'm wondering what you are using for the custom error pages then ?

Custom Server Error Pages addon is no longer working as posted in the support thread for new OSC versions.

 

Or are you not using any custom error pages ? Then I see no chance to keep the visitor on my site.

Thus I liked the idea to have custom error pages in the look and feel of the store, where people can search and view other items.

Any feedback or ideas would be very much appreciated.

 

Thanks!

Link to comment
Share on other sites

@mk_osc

 

Marcus, my host has a utility that let's me make my own custom error pages. So that's my base.

 

Then I've also added Goggles 404 error widget for those type pages.

  • It adds a search box for your site with appropriate search suggestions.
  • It tries to provide alternatives to incorrect URLs. (my site has a human friendly sitemap and this Widget found that page and included the link in the 404 custom error page.

Available in Google Webmaster Tools

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

@@altoid

 

thanks, also a nice idea, then you simply put your static 404 custom URL into the Header Status Handler value field ?

where I have:

Redirect To server_error.php?id=404

you have

Redirect To 404.html

 

But does this not break out of the look and feel of your store ?

 

@@Jack_mcs

thanks for taking care of this, it's working very well for now :thumbsup:

Link to comment
Share on other sites

@@altoid

 

But does this not break out of the look and feel of your store ?

 

 

It does but there are css examples there and discussion about how to modify the look of the page. I haven't done that though...maybe down the list on my huge "to do" list.

 

I haven't used the add on Jack mentioned but that may opt better.

 

Good luck.

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

  • 2 months later...

Hello

 

Great contrib, but i get this error, when i press the review button on a product after installing it:

 

1054 - Unknown column 'r.reviews_status' in 'field list'

 

select r.reviews_status as status from reviews r left join reviews_description rd on r.reviews_id = rd.reviews_id where r.products_id = '4956' and rd.languages_id = 4

 

My shop is V2.2 and i manuel installed the newest version 2.2 addon from 25-7-2013

 

What can be wrong ?

Link to comment
Share on other sites

That's because that field in the database isn't in your database. It is in later versions and some addons. You can try one of the fixes mentioned here. Please let me know if that doesn't do it and I will take a look at the code.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I tried the above. Now the tep error dissaper, but when you press the review button products with reviews i get the 404 pagenot found. So maybee i should be

ALTER TABLE `reviews` ADD `reviews_status` TINYINT( 1 ) NOT NULL DEFAULT '1' AFTER `last_modified` , but the contrib will not Work on reviews ...

Link to comment
Share on other sites

There might also be an issue with the 404/410 redirects.

 

The 404 should be used for hidden products, categories etc.. as they might get 'unhidden' when you get the product back in stock after a long time. (410 Means permanent Gone).

The 410 should only be used for deleted products, categories etc. that never will be back on the sam url?

 

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

Link to comment
Share on other sites

I don't have IE 11 installed so I can't address that problem. I don't know how to respond to "there might also be an issue." The code is setup to return either a 404 or 410 based on the product in the database. I've not had any problems with it.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...