PHP:如何制作我自己的 404 页面未找到错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9577596/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 07:09:54  来源:igfitidea点击:

PHP : How to make my own 404 page not found error

php

提问by Agung Setiawan

Possible Duplicate:
How can I create an error 404 in PHP?

可能的重复:
如何在 PHP 中创建错误 404?

how to make my own 404 page not found error in my site so it looks better than the default
when someone accesses url like this www.blablabla.com/index99.php which is doesn't exist this will automatically redirected to my own 404 page thank beforehand

如何在我的网站中创建我自己的 404 页面未找到错误,因此
当有人访问不存在的 www.blablabla.com/index99.php 这样的 url 时,它看起来比默认值更好,这将自动重定向到我自己的 404 页面预先感谢

回答by blackpla9ue

  1. Make your own custom 404 page
  2. Make an .htaccess fileand place it in your root
  3. Place this line inside the .htaccess file ErrorDocument 404 http://www.domain.com/your-custom-404.php
  1. 制作您自己的自定义 404 页面
  2. 制作一个 .htaccess 文件并将其放在您的根目录中
  3. 将此行放在 .htaccess 文件中 ErrorDocument 404 http://www.domain.com/your-custom-404.php

Read more here

在这里阅读更多