Custom jump instructions for Apache 404 error pages

Source: Internet
Author: User

Source: www.php100.com

 

Custom jump instructions for Apache 404 error pages



The 404 error is actually a file error that we often see, but it is the default effect and is ugly.

Sometimes we need such a feature: we need to record what is the 404 page, and sometimes I need to determine whether the 404 page is a static page that should have been generated by the system but has not been successfully generated, if yes, we should generate this static page and then return the generated static page to the user.

The logic I want to handle is to jump the 404 error to a page named missing404.php.

Then implement the functions we need on this page.

First, define the jump: Use the following statement in the virtual site definition.

Errordocument 404 http://www.blogguy.cn/missing404.php



The virtual site after definition is as follows:

<Virtualhost *: 80>

Serveradmin wayswang@gmail.com

DocumentRoot/usr/local/Apache/htdocs/blogguy.cn

Servername www.blogguy.cn

Serveralias blogguy.cn

Errorlog logs/blogguy.cn _ err_log

Customlog logs/blogguy.cn-access_log2 common

Errordocument 404 http://www.blogguy.cn/missing404.php

<Ifmodule mod_limitipconn.c>

<Location/upimg/soft>

Maxconnperip 5

</Location>

</Ifmodule>

</Virtualhost>

Processing in missing404.php will be explained separately

Another method is provided here, but it is not recommended to use. htaccess to redirect resources.

Add in. htaccess

Errordocument 404/404 .html

You can find that the 404.html file is too small, and IE cannot find it. It is a 404 error. If the size of 404.html is smaller than 512 bytes, ie will deem this error page as not "friendly" and will ignore it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.