The 404 page is a frequent error in the WWW site access comparison. The most common error tip: 404 Not FOUND. The 404 page is the page that is returned when the user enters the wrong link.
error reason cause type
HTTP 404 error means that the link to the page does not exist, that is, the original page URL invalidation, this situation will often occur, it is difficult to avoid, such as: Web site URL generation rules change, Web page file name or move location, import link spelling errors, etc., resulting in the original URL address is inaccessible When the server receives a similar request, it returns a 404 status code telling the browser that the resource being requested does not exist.
404 error page
In general, there are three kinds of reasons that cause this error:
1, unable to access the Web site on the requested port.
2. The Web service extension lockout policy blocks this request.
3. The MIME mapping policy prevents this request.
The impact of SEO
Customizing the 404 error page is a good way to enhance the user experience, but it is often not noticed in the application that 404 pages face the impact of the search engine, for example: the wrong server-side configuration causes the return status code "200" or the custom 404 error page to return "302" using meta-refresh The status code.
How to Set
(for Apache servers only)
1, add the code in the. htaccess file: ErrorDocument 404/error.html;
2, the establishment of a simple html404 page naming error.html;
3. Place the error.html in the root directory of the website;
4, if encountered difficulties, reference this site: error page, SEO 100,000 why the. htaccess file.
Set the benefits of 404
1: Guide users not to close the site, enhance the user experience.
2: Prevent the site from appearing dead links.
Attention matters
1, do not turn the 404 error directly to the homepage of the website, which will lead to the homepage is not included;
2,/error.html front not with the main domain name, otherwise the return of the status code is 302 or 200 status code;
3, 404 pages in line with the site's own design style, it is best to join the site navigation and the bottom (especially the site map)
404 Error configuration
Configuration file in httpd-vhosts.conf
DocumentRoot "F:\abc\111cn.net"
ServerName www.111cn.net
F:\abc\111cn.net ">
Options Indexes followsymlinks Includes execcgi
AllowOverride All
Order Allow,deny
Allow from all
ErrorDocument 404/404.htm
The way to set the 404 error page for Apache server is simple: Just add the following in the. htaccess file.
ErrorDocument 404/notfound.php
NGINX Configuration 404 Error page turn
1. Create your own 404.html page
2. Change nginx.conf in the HTTP definition area add: fastcgi_intercept_errors on;
3. Change nginx.conf (or a separate Web site profile, such as a site profile under Nginx-> sites-enabled)
Add in the server area: Error_page 404/404.html or error_page 404 =http://www.xxx.com/404.html
4. Restart Nginx After the change, test nginx.conf correctness:/opt/nginx/sbin/nginx–t
Errors such as #502 can be configured in the same way.
Error_page 502 503 504/50x.html;