ThinkPHP accesses a module that does not exist and jumps to the 404 page.
Create a file EmptyAction. class. php in ACTION. The code in the file is as follows:
-
- Class EmptyAction extends Action {
- Function _ empty (){
- Header ("HTTP/1.0 404 Not Found"); // returns the 404 status code for HTTP
- $ This-> displayed ("Public: 404 ");
- }
- }
- ?>
Copy code
Set in apache
Add ErrorDocument 404/404. html to your website configuration.
Set in iis
Set error 404 page under IIS/ASP.net
Open the apache httpd. conf configuration file or create a new. htaccess configuration file.
First, modify the application root directory settings, open the "web. config" file, and add the following content to it:
-
-
-
-
-
-
-
-
Copy code
Note: In the preceding example, "error. asp" is the default 404 page and "notfound. asp" is the custom 404 page. modify the file name when using it.
Then, add the following content to the custom 404 page "notfound. asp:
- <%
- Response. Status = "404 Not Found"
- %>
-
Copy code
Python 404
- If (if there are no results)
- {
- // In the past, only the prompt "this post does not exist" was displayed. now it is:
- Request ('/404. php ');
- @ Header ('http/1.1 404 Not Found ');
- @ Header ('status: 404 Not Found ');
- Exit;
- }