The 404 page tells the search engine that the page does not exist and also prompts you to select other operations, next, I will introduce the operation methods for customizing the 404 page in php to my friends who do not have the apache operation permission.
Method 1
The Code is as follows: |
Copy code |
@ Header ("http/1.1 404 not found "); @ Header ("status: 404 not found "); Echo 'echo 404 '; Exit (); |
Load a 404 error page
The Code is as follows: |
Copy code |
@ Header ("http/1.1 404 not found "); @ Header ("status: 404 not found "); Include ("../404.htm "); Exit ();
|
You can also add the. htaccess code to the site as follows:
The Code is as follows: |
Copy code |
Errordocument 404/404 .html |
If you have the permission to configure apahce, you can modify httpd. conf.
Find:
The Code is as follows: |
Copy code |
# ErrorDocument 500 "The server made a boo ." # ErrorDocument 404/missing.html # ErrorDocument 404 "/cgi-bin/missing_handler.pl" # ErrorDocument 402 xxxxxxx |
Change
The Code is as follows: |
Copy code |
ErrorDocument 404/404 .htm |