php defines the implementation code for a 404 page

  • 2020-05-26 08:05:41
  • OfStack

Core code:
 
@header("http/1.1 404 not found"); 
@header("status: 404 not found"); 
echo 'echo 404'; 
exit(); 

If you need to load a 404 page, you can do the following code, focusing on the file path
 
@header("http/1.1 404 not found"); 
@header("status: 404 not found"); 
include("../../404.htm"); 
exit(); 

To see if 404 was set up successfully, use firefox's firebug plug-in

Check the method

When you have installed firebug, use the firefox browser to open the page to check the 404 status code. Click the worm icon in the lower right corner, launch the "network" TAB, and then open the "network all /html all/headers"; If the 1 slice is normal, you can see the page parameters including headers and the response.

404 pages face site impact

The impact on seo is not great. But it's better than nothing. If you have this permission, you'd better set the 404 page to 1. Like sitemap 1, not all sites have to be set, but sometimes they do.
When deciding whether to set up a 404 page, think more about the user experience, not seo.

Take a look at the definition of apache 404
Setting up a 404 error page for apache server is as simple as adding the following to the.htaccess file:
errordocument 404 /notfound.php

Related articles: