An equal sign caused by the murder (talk about nginx correct 404 configuration) _nginx

Source: Internet
Author: User

This is a bloody lesson, so it's not a point. Because a major problem has recently occurred, the site traffic has fallen sharply, down nearly 80%. As a result of the incident before doing some work, add a lot of friends chain, and the weight of the outside station is quite high, on that day also occurred a horse incident, of course, also immediately resolved. Also did some other key words inside, outside the chain optimization and so on. This makes it harder to find the cause of the problem. Accidental reasons found that Baidu included the link began to appear wrong, because the site URL way to use the directory structure, the last character is/, however, Baidu included the page is no reason to remove this line, and this access mode, I did not do compatible. At that time also looked at the site page rewrite results, did not find where the link to the page has been such a mistake, then Baidu included in these pages from? It's really unknown. Maybe some addresses in the chain removed the diagonal line from the list? No matter how it is included, do the compatibility work as soon as possible, because the wrong link will be transferred to the 404 page up. Just checked again, found a little strange.

The following excerpt from Baidu Encyclopedia:

Copy Code code as follows:

404 Impact on SEO

Customizing the 404 error page is a good way to enhance the user experience, but it often fails to notice the impact on the search engine, such as a bad server-side configuration that causes the return of a "200" status code or a custom 404 error page to use meta-refresh to return a "302" status code. A custom 404 error page that is correctly set should not only be displayed correctly, but should also return the "404" error code instead of "200" or "302". Although the HTTP status code is "404" or "200" for the user, it is very important for the search engine.


Search engine spider when request a URL to get "404" state response, that means that the URL is no longer indexed and the page is deleted from the index database by feedback to the datacenter, and of course the deletion process may take a long time; and when the search engine gets "200" Status code, the URL is considered valid and will be indexed and included in the index database, so that the two different URLs have exactly the same content: Customize the contents of the 404 error page, which causes the replication Web page problem. Light is the search engine down the right, heavy will k off the site.

And exactly I found here on the server Nginx 404 of the configuration has such a problem, access to the invalid address, jump to the 404 page Return status code is 200, Khan. How could that be?

A murder caused by an equal sign

The reason for the final discovery is that this state code error is caused by an extra "=" in the configuration.

Now most of the online nginx 404 configuration or Error_page 404 =/404.html; Note that this is a wrong notation, the correct way to write is not the equal sign, because the equal sign of the Nginx to 404 of the error into the link to the 200 normal status code shows the custom 404 pages, which for the average user does not look different, but the signal to the search engine is fatal. Do not avoid. Because the previous server, I have been using Apache to do, is also the first time encountered this problem. After the change with tools to check, has been normal.

In fact, this error if better use, can also be mistake, but also with the industry to learn that, of course, this is a partial door left way, not here to teach bad people. Of course, if the outside chain flow is small, or no large flow of error link inflow, this will not be established.

Finally, this tool can be used to detect:

http://www.seochat.com/seo-tools/check-server-headers/

Enter a wrong path under your site and detect a "http/1.1 404 Not Found" on it.

Or use the following method to check more easily, at the command line, enter:

Copy Code code as follows:

# curl-i Http://www.yourdomain.com/testurl.html
http/1.1 404 Not Found
server:nginx/1.4.4
Date:fri, 2014 02:36:39 GMT
Content-type:text/html
content-length:1782
Connection:keep-alive
Vary:accept-encoding
ETag: "5018ffe4-6f6″

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.