Home > php教程 > PHP开发 > body text

如何在linux系统下自定义404错误页?

WBOY
Release: 2016-06-07 17:23:17
Original
1485 people have browsed it

十一黄金周期间,手下管理的一个网站空间租用准备过期了,确定以后不需要绑定子域名,于是把网站由原来的windows2003系统转移到linux系统,这原因也出于费用的精打细算,因为同样的空间,linux比window便宜多了。


网站的整过转移过程十分顺利,除了404错误页面设置有异于windows系统外。那么在linux系统下如何设置自定义404错误页呢?


下面将分两个步骤实现

一、在网站的根目录下查看是否有.htaccess 文件,如果没有则自建一个。在.htaccess 文件中加入如下语句:

ErrorDocument 404 /404.html
Copy after login

二、在网站根目录下建立一个 404.html 文件,文件的后缀需要和.htaccess中指定的文件一致。


完成上面的步骤后,在地址栏输入该网站的一个不存在的页面进行测试,如果打开页面是你自定义的那个404.html,说明自定义404错误页成功。




Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!