Thinkphp's failure page (404)

Source: Internet
Author: User

Here are two approaches, both of which require familiarity with the configuration of the convention.php page.

One is to modify error_page This configuration item, this place is recommended to use absolute path, because the path with relative path is the current error page, may not be able to navigate to the page you expect to arrive.

Path:/123.56.183.226/web/thinkphp/conf/convention.php

The above representative's configuration will jump to Baidu's homepage when the site access fails. Of course this is not think PHP officially encouraged by the operation, the official does not encourage you to make any changes to the convention.php file, because this file is a custom file, but allows you to overwrite the configuration here, so it is recommended to choose the following practice .

The other is the modification of the failed template defined in Tmpl_exception_file, in which you can write directly to the failed detail page, or you can add the function (header ()) of the page jump to the extension.

Path:/123.56.183.226/web/thinkphp/conf/convention.php

It should be noted that the 404 jumps of both methods must be in non-debug mode:

Path:/123.56.183.226/index.php

In both methods, if error_page is defined, the Tmpl_exception_file is no longer called

Thinkphp's failure page (404)

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.