Custom 404 error page under Apache

Source: Internet
Author: User

404 The purpose of the page is to tell the browser that the requested page does not exist or link the error, while directing the user to use other pages of the site instead of closing the window to leave.

Many open-source systems, including CMS systems, blog systems, etc. do not provide 404 pages or provide 404 pages did not meet the requirements of SEO, which makes the site's authority greatly discounted.

404 page How to achieve the effect to meet the SEO requirements?

The search engine uses the HTTP status code to identify the state of the page. When the search engine gets a bad link, the site should return a 404 status code that tells the search engine to discard the index of the link. If a 200 or 302 status code is returned, the search engine will index the link, resulting in a number of different links pointing to the same page content. As a result, search engines have significantly reduced trust in the site. --Many websites have this problem: 404 the page Returns a 200 or 302 status code instead of a 404 status code.

The correct way to build 404 pages is: (only for Apache servers)

Method One:

First you have to open Apache's Rewrite_module module, support. htaccess. The. htaccess file (or already exists) is then created at the root of the Web site, plus this sentence errordocument 404/404.html can be

Method Two:

    1. # vi/etc/httpd/conf/httpd.conf
    2. Cancel ErrorDocument 404/missing.html Pre-comment
    3. Can be modified to:
    4. ErrorDocument 404/errpage/404.html
    5. The path to place the 404 error page is the Errpage directory in the Apache root directory
    6. Then create a new 404.html in/var/www/html/errpage and fill in the customizations
    7. # Service httpd Restart

Attention:

    • Do not turn 404 errors directly to the homepage of the website, which will lead to the homepage is not included;
    • Do not bring the primary domain name in front of/error.html, otherwise the status code returned is 302 or 200 status code.

This allows you to customize some of the more user-friendly tips: For example, the page is being maintained moderately.

Custom 404 error page under Apache

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.