thinkphp access to nonexistent modules jump to page 404

Source: Internet
Author: User
Keywords thinkphp
Tags access aliyun asp class code configuration create error

In the Action, create a new file emptyhttp://www.aliyun.com/zixun/aggregation/16339.html ">action.class.php, the code in the file is as follows:

<?php class Emptyaction extends action{function _empty () {header ("http/1.0 404 Not Found");//make HTTP return 404 status Code       $this->display ("public:404"); }?>

Set in Apache

Add ErrorDocument 404/404.html to your site configuration.

Set in IIS

Iis/asp.net Set 404 Error page

Open the Apache httpd.conf configuration file or create a new. Htaccess profile

First, modify the settings for the application root directory, and open the "Web.config" file editor, adding the following:

<configuration> <system.web> <customerrors mode= "on" defaultredirect= "error.asp" > <error Statuscode= "404″redirect=" notfound.asp "/> </customErrors> </system.web> </configuration>

Note: In the above example "error.asp" is the default 404 page of the system, "notfound.asp" is a custom 404 page, please modify the corresponding file name when using.

Then, in the Custom 404 page "Notfound.asp", add:

<% response.status = "404 Not Found"%>

PHP 404

if (if there is no result) {//is previously only a hint that "the post no longer exists", it is now: require ('/404.php '); @header (' http/1.1 404 Not Found '); @he       Ader (' status:404 not Found '); }

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.