You are here:  » Non-Existent Product Pages

Support Forum



Non-Existent Product Pages

Submitted by philstone on Thu, 2007-08-02 10:49 in

Hi Dave

Hope all is well with you!

Was wondering about non existent product pages, eg. on my site i do not have a product called scooby doo, but if you click the link there is a product page comes up simply saying that the product could no be found, is there anyway i can stop this happening, so that is doesn't make an html page for products not on my database?

Regards

Philip Stone
www.buy24-7.net

Submitted by support on Thu, 2007-08-02 12:50

Hello Phil,

Yes - one easy thing you could do is to return 404 (not found) instead of displaying the product not found page. In products.php look for the following code (line 58):

$banner["h2"] .= "(".translate("product not found").")";

Replace this with:

header("HTTP/1.0 404 Not Found");
exit();

Cheers,
David.

Submitted by philstone on Tue, 2010-07-27 08:35

Hi David

was wondering when i use the script above it seems to disable /admin/ as well as other sub domains, how would i prevent this happening? (ie just returns a 404 error when i go to /admin/)

regards

Phil Stone
www.buy24-7.net

Submitted by support on Tue, 2010-07-27 08:57

Hi Phil,

I see that you have a modification in place also to have the product URLs at the top level, so I actually think this is an issue in .htaccess.

Check that immediately before the product rewrite (which should be at the end of your .htaccess) that you have:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

This will make sure that the product rewrite URL does not interfere with any other top level HTML files or directories that already exist... If you're not sure of course; if you could email me your .htaccess I'll check it out for you...

Cheers,
David.

Submitted by philstone on Wed, 2010-07-28 20:40

hi david

was wondering, is it possible for this to forward to a "search.php?q=nolongeractiveproduct" page instead of 404 error code?

regards

Phil Stone
www.buy24-7.net

Submitted by support on Thu, 2010-07-29 08:39

Hi Phil,

Sure - in place of:

  header("HTTP/1.0 404 Not Found");
  exit();

...simply use:

  header("Location: ".$config_baseHREF."search.php?q=".urlencode($q));
  exit();

Cheers,
David.

Submitted by philstone on Thu, 2010-07-29 10:08

thanks again david!!!

regards

Phil Stone
www.buy24-7.net