homedecor Posted January 14, 2009 Share Posted January 14, 2009 Here is my problem. I have had my site up and running for a little over a year now and has been index by google nicely. I add and delete products a lot. The products that I delete stay indexed with google but changes to the product not found page. This is giving me duplicate content because all the deleted products show the same thing now. Is it possible to give a 404 error when this message comes up. From what I am understanding is that google will take 404 pages out of their index, solving my problems. I would just like to make this process automatic so that I don't have to go to webmaster tools and request for a removal. Any suggestions would be great. Thanks in advance. Link to comment Share on other sites More sharing options...
clustersolutions Posted January 28, 2009 Share Posted January 28, 2009 I had the same problem...in product_info.php...add the if block after the SQL statements at the beginning of the file and the url response should give a 404 response. Test it first...I hope this helps...Tim $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_check = tep_db_fetch_array($product_check_query); //define('FULL_TITLE', TITLE . $breadcrumb->_trail[sizeof($breadcrumb->_trail) - 1]['title']); if ($product_check['total'] < 1) { echo header("HTTP/1.0 404 Not Found"); } Link to comment Share on other sites More sharing options...
homedecor Posted January 28, 2009 Author Share Posted January 28, 2009 Hey thanks for that. I found the same thing or at least close to it. I put this code in the same place as you said. <?php if ($product_check['total'] < 1) { header("HTTP/1.1 404 Not Found"); header("Status: 404 Not Found"); }else{ } ?> I then went as far as checking on this site seoconsultants.com/tools/headers.asp to make sure the correct status code was being given. It does work! Link to comment Share on other sites More sharing options...
clustersolutions Posted February 6, 2009 Share Posted February 6, 2009 Hello Homedecor: Are you concerned with chaning your site's search engine position by deleting products and further sending a 404 header? Regards, Tim Hey thanks for that. I found the same thing or at least close to it. I put this code in the same place as you said. <?php if ($product_check['total'] < 1) { header("HTTP/1.1 404 Not Found"); header("Status: 404 Not Found"); }else{ } ?> I then went as far as checking on this site seoconsultants.com/tools/headers.asp to make sure the correct status code was being given. It does work! Link to comment Share on other sites More sharing options...
gipielle Posted May 4, 2011 Share Posted May 4, 2011 Has someone find the solution ? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.