To create a new file EmptyAction.class.php in the action, the code in the file is as follows:
The code is as follows |
Copy Code |
<?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:
The code is as follows |
Copy Code |
<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:
The code is as follows |
Copy Code |
<% Response.Status = "404 Not Found" %> |
PHP 404
code is as follows |
copy code |
if (if there is no result) { //is only a hint that "the post no longer exists" is displayed, now: Require ('/404.php '); @header (' http/1.1 404 Not Found '); @header (' Status : 404 Not Found '); exit; } |