Home >Backend Development >PHP Tutorial >ECSHOP optimization ecshop error redirection address change_PHP tutorial
The original ECSHOP, when some products cannot be found or deleted, or when dynamic pages are directly accessed, when parameters are lost or the database cannot find matching data, the program The processing is directed to the home page, which is not conducive to optimization. Some page programs need to be modified, such as: goods.php
. Accessed without parameters or wrong parameters, such as http://www.xxx.com/goods.php is redirected to the home page, and the test http status is 302, which is not conducive to optimization.
if ($goods === false)
{
/* If no records are found Then jump back to the homepage*/
ecs_header("Location: ./n");
exit;
} Now change for
if ($goods === false)
{
/* If no one is found The record will jump back to the homepage*/
ecs_header('HTTP/1.1 404 Not Found');
ecs_header("status: 404 Not Found");
header("refresh:5;url=http://www.ledaokj.com");
print('
Automatically jump after five seconds~~~
exit;
}The same things that need to be modified are: article.php, category.php, goods.php, etc.
This article is reproduced from Shenzhen Ledao Network Technology (www.ledaokj.com) Detailed text reference: ECSHOP Optimize ecshop error redirection address change