search
Homephp教程php手册php 定义404页面方法

先看下PHP中实例代码:

@header("http/1.1 404 not found"); 
@header("status: 404 not found"); 
echo 'echo 404'; 
exit();

查看404是否设置成功可以利用firefox 的firebug插件来查看,查看方法:

在已经安装firebug的情况下,用firefox浏览器打开要检查404状态码的页面,点击右下角小虫的图标,启动"网络"标签,依次打开"网络–所有/html–headers",如果一切正常,你就可以看到包括headers、响应在内的各项页面参数了.

404页面对网站影响:

对seo的影响并不大,但是有,总比没有好,如果你拥有这个权限,你最好还是设置一下404页面,这个东西跟网站地图一样,不是所有的网站都得设置,但是有时候有设置的必要.

再考虑是不是要设置404页面时,应该多考虑用户体验,而不是seo.

apache 404定义:

apache里设置404错误页面为apache server设置 404错误页面的方法很简单,只需在.htaccess 文件中加入如下内容即可:errordocument 404 /notfound.php

本文地址:

转载随意,但请附上文章地址:-)

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version