You are here:  » 404 Error Page


404 Error Page

Submitted by technoarenasol on Fri, 2012-11-09 19:00 in

Hi David

How can display 404 error page If any product page link not available or broken link or old product link (which currently not available in any feed) ..

also tell me how to write title for search page result like "searching for nokia asha 302"

Submitted by support on Sat, 2012-11-10 09:37

Hi Amin,

The products page do actually return an HTTP 404 (Not Found) response if a product no longer exists in the database. Additionally, related products will then display (regardless of $config_useRelated settings) which should enable your visitors to locate a suitable alternative.

You'll find the relevant code at line 73 of products.php:

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

However, if you did want to use a custom 404 HTML; you could REPLACE this with:

      header("HTTP/1.0 404 Not Found");
      require("html/404.php");
      exit();

...and in addition; create a new file html/404.php containing the full 404 HTML page you wish to show; which can be as simple as

<html><body><h1>404 Not Found</h1></body></html>

Regarding search page titles; the query itself is the default title - look for the following code at line 320 of search.php:

  $header["title"] = htmlentities($q,ENT_QUOTES,$config_charset);

...so if you wanted to add custom text in-front of the query, REPLACE that with:

  $header["title"] = "Searching for ".htmlentities($q,ENT_QUOTES,$config_charset);

Hope this helps!

Cheers,
David.
--
PriceTapestry.com