Home >Backend Development >PHP Tutorial >ECSHOP optimization ecshop error redirection address change_PHP tutorial

ECSHOP optimization ecshop error redirection address change_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:30:491011browse

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('

An error occurred! This page does not exist and will be returned to the homepage...< br>
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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/764245.htmlTechArticleThe original ECSHOP, when some products cannot be found or deleted, or directly respond to the news Page access, when parameters are lost or the database cannot find matching data, the program handles...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn