To submit data to Baidu, we basically will think of Sitemap, recently launched the etag is what dongdong? Is it really effective?
Sitemap is one of the most important ways to solve the site, and the usual Sitemap updates are not very timely, and volume are relatively large, at this time also consumes the corresponding Web site traffic and bandwidth. And ETag can be used to indicate whether the Web page has changed, if there is no change to return 304 status code, you do not have to retransmit the entire page.
After our sitemap is configured with ETag, monitoring the log for a period of time has found that its sitemap response time and time-consuming average time are significantly reduced, the crawler access to the sitemap file increased the number of, for inclusion, through the chart can also see the relative growth curve, Our overall rate of increase in the broad range of 2%–5% around. So here, we strongly recommend that you set Sitemap ETag, a simple small action can be seen relatively obvious effect is very good.
ETAG Full Name Entitytags,http protocol specification defines "ETAG" as "entity value of the requested variable". We can also interpret ETag as a sign that the client is associated with the server. This token tells the client whether the current page has changed since the last request, and when the change occurs, the value of the etag is recalculated and the 200 status code is returned. If there is no change, return the 304 status code. This will not reload the entire page information.
As follows, is our site sitemap file header information:
We see that the ETag contains a series of data, which is a computed value, and if it changes, the page content must have changed. If the page does not change, the header information should read as follows:
When we configure etag with technical communication, we need to verify this in this way. The first time you access the 200 status code, there is a etag line of text, when you access the page again, the status code for the 304,etag value unchanged. At this point, we can determine that the ETag configuration was successful.
In addition, after the Sitemap is enabled ETag:
1, Baidu can more timely response to the Sitemap update;
2, the page does not update the case, the flow of the consumption of a minimum;
3, Baidu more timely crawl Sitemap, for better collection;
In most cases, however, ETag is used with last-modified to take advantage of the caching of clients such as browsers. Because the server first generates a Last-modified/etag tag, the server can use it later to determine if the page has been modified. Essentially, the client requires the server to authenticate its (client) cache by passing the token back to the server.
How does the site server configure ETag?
It is best to configure the whole station ETag, so for the site, in the bandwidth consumption, crawler crawling on the upgrade will still have a lot of revenue.
First, Apache
Apache sets the ETag value according to the configuration in the configuration file, and the default Apache Fileetag is set to:
Fileetaginode Mtime Size
That is, based on these three properties to generate ETag value, they are implemented through some algorithms, and output into the hex format, adjacent properties between the-separated, such as: "2e681a-6-5d044840", which contains three paragraphs, respectively, representing the Inode,mtime, Size based on the algorithm to calculate the value of the hex format, you can change the Apache Fileetag settings, such as set to Fileetagsize, then the resulting etag may be: "6", set a few segments, ETag value of several segments.
Detailed configuration:
Step 1
Add the. htaccess file in the directory where you want to enable ETag and add a row to it, as shown in figure: Fileetagmtime Size
To overwrite the default innode mtime size ETag, because the Innode used by the default etag will cause the same file to be different from the etag generated on the distributed server.
Steps 2
If the. htacces file already exists, make sure that there is no fileetagnone in the directory/.htacces file that you want to enable ETag. If there is Fileetag None, please delete the line.
Check that the etag is not removed with mod_headers, that is, the following statement is not present in the httpd.conf file.
Loadmoduleheaders_module modules/mod_headers.so
Headerunset ETag
If this is the case, delete the Headerunset etag line.
Steps 3
Restart the httpd, and the ETag is enabled.
Second, Nginx
Step 1
Confirm Nginx version, command: Nginx installation directory/sbin/nginx–v,
Version is 1.7.3 and higher, proceed to step 2, version 1.7.3 below, 1.3.3 and above, proceed to step 3, version 1.3.3, do not support ETag, please upgrade your nginx.
Step 2
Confirm that ETag is not turned off: open Nginx profile nginx.conf (default location nginx installation directory/conf/) to ensure that Etagoff is not present, and if this is the case, delete this row.
Confirm that you did not use Ngx_headers_more to clear the ETag header: Also in the configuration file can not appear any of the following statements, if it appears please delete it.
Restart the Nginx, and the ETag feature is enabled.
Step 3
Check to see if Gzip is turned on, and if there is a conflict with etag, there is a conflict to step 4 without going to step 2.
Open Nginx's profile nginx.conf (default location nginx installation directory/conf/), where gzip on; statement proof turned on gzip, as shown
When you open gzip, may conflict with ETag, with the browser repeatedly request this site static elements, if only return 200, do not return 304, proof of conflict, please go to step 4; no conflict to step 2.
Step 4
Turn off gzip, gzipon in the previous step, or gzip off; then go to step 2.
If you do not want to turn off gzip, and to open etag, while still insisting on using the current Nginx version, you can only modify the source code and recompile.
Download this version of the installation package and unzip it to the directory below/SRC/HTTP/MODULES/NGX_HTTP_GZIP_FILTER_MODULE.C
About 309 lines of Ngx_http_clear_etag (r) in the file, and one line commented out or deleted. The following figure
If Ngx_http_clear_etag (R) is not found, it is found Ngx_http_weak_etag (R), and the following illustration shows that the Nginx
There are no issues with gzip and etag conflicts and no modifications are necessary.
Recompile source installation Nginx, resolve this conflict, and then go to step 2.
Third, IIS
IIS7 is the default open ETag, if there is no etag, please follow the steps below to set it.
Open Internet Information Services (IIS) Manager, as shown by double-clicking the HTTP response header (HttpResponse Headers),
Select No grouping label, and right click on Add in the blank space.
Set name to Etag,value for double quotes
Configure Web.config:
completed.