您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 定西分类信息网,免费分类信息发布

php怎么设置404页面

2024/4/22 7:56:25发布18次查看
php设置404页面的方法:首先找到并打开“apache\conf\extra\httpd-multilang-errordoc.conf”文件;然后修改404对应文件即可。
推荐:《php教程》
php创建自定义404页面
apache服务器:
修改 :apache\conf\extra\httpd-multilang-errordoc.conf  文件
如下所示,修改404 对应文件即可
errordocument 400 /error/http_bad_request.html.varerrordocument 401 /error/http_unauthorized.html.varerrordocument 403 /error/http_forbidden.html.varerrordocument 404 /error/404.htmlerrordocument 405 /error/http_method_not_allowed.html.varerrordocument 408 /error/http_request_time_out.html.varerrordocument 410 /error/http_gone.html.varerrordocument 411 /error/http_length_required.html.varerrordocument 412 /error/http_precondition_failed.html.varerrordocument 413 /error/http_request_entity_too_large.html.varerrordocument 414 /error/http_request_uri_too_large.html.varerrordocument 415 /error/http_unsupported_media_type.html.varerrordocument 500 /error/http_internal_server_error.html.varerrordocument 501 /error/http_not_implemented.html.varerrordocument 502 /error/http_bad_gateway.html.varerrordocument 503 /error/http_service_unavailable.html.varerrordocument 506 /error/http_variant_also_varies.html.var
404文件在如下路径下:
apache\error\404.html
其他错误文件修改方式同上。
修改完成后,重启apache服务器即可!!!
nginx服务器:
1、创建自己的404.html页面放在网站根目录下。
即:网站代码根目录/error/404.html
(测试时,不知道为什么必须创建error文件夹,直接把404页面放到根目录下失败)
2、修改nginx.conf文件在http定义区域加入:
fastcgi_intercept_errors on;
3、更改nginx.conf或虚拟主机的域名.conf在server区域加入(bitnami.conf):
error_page 404 = /404.html;
4、重启nginx
5、此时访问不存在url即跳转到自定义404页面
以上就是php怎么设置404页面的详细内容。
定西分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录