Common HTTP status codes and solutions for webmasters

The HTTP status code is a 3-digit code used to indicate the HTTP response status of the web server. In the process of maintaining the website, webmasters may see various response status codes in the webmaster tool background crawl exception or in the server log, some of which may even affect the SEO effect of the website. The following Baidu engineers will help you Some common HTTP status codes and solutions are sorted out:

301: (Moved Permanently) The requested web page has been permanently moved to a new location. When the server returns this response (as a response to a GET or HEAD request), it automatically forwards the requester to the new location.
Use environment and impact: When the site is migrated, the domain name is changed, or the website is revised, it is recommended to use the 301 return code. In addition to reducing the traffic loss caused by the website revision, this code can also notify Baiduspider that a certain webpage or website has been permanently moved to new location, thereby transferring weight and ranking to the target page as quickly as possible.
IIS server solution: Open the Internet Information Service Manager, right-click on the webpage or directory to be redirected, select "Redirect to URL", and enter the URL of the target webpage to be redirected to in the "Redirect to" input box. URL address, select "Permanent redirection of resources" (remember), and finally click "Apply".
Apache server solution: In Apache, you only need to find the .htaccess file and set it to achieve 301 settings. Find redirectpermanent/old-url.htmlhttp://new-url.com: Just modify this sentence.

302: (Temporarily Moved) The server is currently responding to requests from web pages in different locations, but the requester should continue to use the original location for future requests. This code is similar to the 301 code in response to GET and HEAD requests and automatically redirects the requester to a different location.
Usage environment and impact: The 302 code is generally a temporary jump by default, and it is only used to temporarily jump to a new temporary URL or URL. Generally speaking, Baiduspider will continue to crawl and index the original location. Because it is often used for black hat cheating such as domain name URL hijacking, many webmasters feel that Baidu is not friendly to 302, and it is not recommended to use this code if a certain page or website is permanently moved.
Solution: If you want to permanently move a certain page, the IIS server only needs to follow the same steps as setting 301, remember to select "this resource will permanently jump" for the last item, and the Apache server can rewrite the rewrite in the .htaccess file; generally Regular expressions are used when setting URL redirection rules in batches.

400: (Bad Request) The server did not understand the syntax of the request.
Use environment and impact: Generally, this status code can be divided into two situations: 1. The semantics are incorrect, and the current request cannot be understood by the server. 2. The domain name of the accessed page does not exist or the request is wrong.
Solution: On the premise of confirming that the domain name or URL is correct, you can first ping the domain name to see if it resolves to the IP of the server or space. If so, you can go to the management panel of the space to see if there is a bound domain name. If Yes, it may be a problem with the space provider, just find the space provider to solve it!

403: (Forbidden) The server understood the request, but refused to fulfill it.
Usage environment and impact: Generally, this status code can be simply understood as no access permission, and it is usually used when permission settings are required for files or directories on the server; if this status code is displayed when Baiduspider tries to crawl valid web pages on your website , it may be that your server or host refuses Baiduspider to access it. If you return 403 for a long time, the search engine will think that the URL is an invalid link and will delete it, which is not friendly to search engines.
Solution: The solution to the server 403 problem depends on the situation. If it is caused by DNS resolution errors, or because there are too many connected users and the server is busy, you can solve it by rebuilding the dns cache; if it is caused by wrong folder security attribute settings, you must Modify the security attributes of the folder; indeed, some pages do not want to be indexed by search engines, it is recommended to block spiders by writing them into the robots rule file.

There are several other ways to solve the 403forbidden error:

The solution to the 403forbidden error caused by apache
Open the apache configuration file httpd.conf and find this code:
OptionsFollowSymLinks
AllowOverrideNone
Orderdeny, allow
Denyfrommall

Sometimes due to the configuration of php, the "Denyfrommall" here has rejected all connections. Change this line to "allowfromall", the modified code is as follows, and the problem is solved.
OptionsFollowSymLinks
AllowOverrideNone
Orderdeny,allow
Allowfromall

The reason for the error is that most foreign hosts enable mod_security when configuring Apache, that is, the security check is turned on. If the submitted information contains keywords such as select, %, bin, etc., Apache will prohibit it and disable it. Gives 403, 404, 500 etc errors.

The solution to the 403Forbidden error in the HawkHost space.
Sometimes Modsecurity is installed on the shared server. When the URL contains other sensitive characters such as "%", it will also be blocked by Modsecurity. The solution is
to add the following code in the .htaccess file:
SecFilterEngineOff
SecFilterScanPOSTOff

directly placed in the root directory of the website or the directory where the program runs.

404: (Not Found) The server could not find the requested web page.
Usage environment and impact: For example, if the request is made for a web page that does not exist on the server, the server will usually return this code. Baiduspider usually thinks that the webpage has expired, so it deletes it from the search results, and the spider will not crawl if it finds this URL again in a short period of time.
What I have to mention here is that many webmasters want to customize the 404 page. They need to ensure that the status code returned when the spider visits is 404. If the status code 200 is returned due to improper settings when the 404 page jumps, it is easy to be searched by search engines. It is believed that there are a large number of duplicate pages on the website, resulting in a drop in authority.
Solution: When the existing web content cannot be accessed due to path changes, you should use 301 permanent redirection to jump to the new address, and let the server return the 301 status code, which is the most friendly to search engines; if a certain page If the content has indeed been deleted, or expired, you should make a friendly 404 file page, and make sure that the page returns a 404 status code.

408: (Request Timeout) The server timed out while waiting for the request.
Usage environment and impact: This code is returned when the client does not finish sending a request within the waiting time of the server; if Baiduspider returns this code for a long time when visiting the website, the search engine will think that the access speed of the website space is not fast Stable, thus affecting the ranking;
Solution: Check the workload of the web server to see whether it is caused by the surge in traffic or the workload of the client system. If neither is the case, it is recommended to check the server network or replace it with a better space service business.

410: (Deleted) The requested resource has been permanently removed.
Use environment and impact: The use of this status code is somewhat similar to 404. When a file is permanently removed from the server (rather than transferred to another location), you can use the 410 status code to tell the search engine to delete the included link. , to avoid dead links when search engines revisit.
Solution: When the status code appears on the server, it is necessary to check whether the resource has been permanently removed. If the URL is still valid, it means that there are some errors in the settings of the web server, and corresponding settings need to be made. If transferred, a 301 code should be used to specify the new location of the resource.

500: (Server Internal Error) The server encountered an error and could not complete the request.
Usage environment and impact: The status returned when the page code fails. Generally speaking, when the visited website or page ASP or PHP has a code error, such as syntax error, database connection error, etc., and the server environment just turns off the output prompt of the error message, a 500 error feedback will appear. If the website returns a large number of 500 errors, it is not only unfriendly to the user experience, but also affects the search engine's score on the page and thus affects the ranking.
Solution: First, check the source code of the webpage to see if there are irregular grammar misspellings, missing codes, etc. that cause page verification failures, or database connection statement errors, etc. If not, check whether the server responds normally, whether components not supported by the server are installed, and restart the server if necessary.

502: (Bad Gateway) The server, acting as a gateway or proxy, received an invalid response from an upstream server.
Usage environment and impact: This code is generally caused by a gateway error (not necessarily its own web server). When the server acting as a gateway or proxy contacts the upper-level content server and receives an invalid response, it will return this code.
Solution: First of all, under the premise that our browser uses a proxy, we can try to clear the browser cache, and then check whether the gateway is configured correctly, or refresh the server and try to resend the request.

503: (Service Unavailable) The server is currently unavailable (due to being overloaded or down for maintenance). Usually, this is only a temporary state.
Usage environment and impact: This code should be returned when the website is temporarily closed or other temporary conditions, such as bandwidth overrun, server response not responding in time, etc. Generally speaking, Baiduspider will think that the webpage is temporarily inaccessible, and will not directly delete this URL, and will visit it again in a short time. At that time, if the webpage is restored, it will be crawled normally. This is also the difference between 503 and 404. If it is 404, it will usually be deleted from the search results and will not be crawled again.
Solution: Generally, this situation is caused by the shutdown or maintenance of the website server, just contact the server administrator or service provider to solve it!

504: (Gateway Timeout) The server, acting as a gateway or proxy, did not receive the request from the upstream server in time.
Usage environment and impact: When the server working as a gateway or proxy tries to execute the request, it fails to receive a response from the upstream server (the server identified by the URI, such as HTTP, FTP, LDAP) or auxiliary server (such as DNS) in time.
Solution: This error is entirely caused by slow IP communication between backend computers, possibly including the web server. For this reason, this problem generally requires the webmaster to contact the Internet Service Provider (ISP) and the Web server software provider to check the flow of IP data transmission between different computers under its control to solve it.

505: (HTTP version is not supported)
Usage environment: The server does not support, or refuses to support the HTTP version used in the request. This implies that the server cannot or will not use the same version as the client.
Solution: If this error occurs, you can upgrade the Web server software. If a request for version 1.x fails, it is likely that your web server does not support the 1.x protocol version very well, rather than not supporting it at all.

Guess you like

Origin blog.csdn.net/qq_45381281/article/details/108939400