您好,欢迎访问一九零五行业门户网

php中header自定义404状态错误页面_PHP教程

404页面就是一个告诉搜索引擎这个页面不存在了,同时也提示用户可以选择其它的操作了,下面我来给没有apache操作权限朋友介绍php中自定义404页面的操作方法。
方法一
 代码如下 复制代码
@header(http/1.1 404 not found);
@header(status: 404 not found);
echo 'echo 404';
exit();
加载一个404错误页面
 代码如下 复制代码
@header(http/1.1 404 not found);
@header(status: 404 not found);
include(../../404.htm);
exit();
也可以在站点中加入.htaccess 代码如下
 代码如下 复制代码
errordocument 404 /404.html
如果有apahce配置权限,我们可以修改 httpd.conf
找到:
 代码如下 复制代码
#errordocument 500 the server made a boo boo.
#errordocument 404 /missing.html
#errordocument 404 /cgi-bin/missing_handler.pl
#errordocument 402 xxxxxxx
修改为
 代码如下 复制代码
errordocument 404 /404.htm
http://www.bkjia.com/phpjc/628782.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/628782.htmltecharticle404页面就是一个告诉搜索引擎这个页面不存在了,同时也提示用户可以选择其它的操作了,下面我来给没有apache操作权限朋友介绍php中自定...
其它类似信息

推荐信息