Data proves: if a webpage loads for more than 4 seconds, 25% of users will give up; if a mobile webpage takes more than 10 seconds, 50% of users will give up, and 60% will not return; Google search results are 0.4 seconds slower, and searches are reduced by 8 million times a day; 40 % of mobile shoppers will abandon a website that takes more than 3 seconds to load; Amazon’s daily sales are approximately US$67 million, and a webpage delay of 1 second can lead to a loss of US$1.6 billion throughout the year. This is enough to prove how important website loading speed is. Implementation has proven that if the website loading speed is delayed from 100ms to 400ms, users will be reduced by 02.%, and daily search losses will reach 0.6%.
Any webmaster hopes to reduce the page loading time as much as possible, and any search engine hopes to provide users with a good user experience service, improve the overall quality of the website, and increase user satisfaction. Everyone hopes to enjoy a fast Network experience. How to improve website loading speed? You can consider three aspects.
Choosing a suitable host for your corporate website is the first step in website construction. Having a professionally configured host will greatly help improve the loading speed of the website.
1. Use browser cache
When a user visits a site, many resources on the website need to be loaded slowly from the server to the client. In comparison, this will cause a delay in the loading speed of the website, especially JPEG images. If these contents can be loaded from the browser's cache Obtained from , it will speed up the loading time and use the browser's cache to store resources so that the next time the user visits the same site, the site will load faster.
2. Enable keep-alive signals
Keep-alive signals are sent at predetermined intervals, which play a big role on the Internet. After a signal is sent, if no reply is received, the link will be routed through another path until link recovery is received. In fact, HTTP keep-alive allows the TCP connection to survive, and it helps reduce subsequent request delays, so, Please contact your hosting provider and tell them your needs, as most hosting companies have this feature disabled.
3. Enable gzip compression
Gzip compression is currently the most popular and effective compression method, which can reduce response time by about 70%. gzip compression, reduces the size of HTTP responses and helps reduce response times. I think this is the easiest way to reduce page weight, just add the following code to your htaccess file:
#Compressed text: html, javascript, CSS, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/Javascript
AddOutputFilterByType DEFLATE application/x-javascript
#Extension compression of certain file types:
SetOutputFilter DEFLATE
Or there is an easiest way, at the top of your HTML/php file, use the following PHP code:
<?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start();?>
For some external Javascript files in the site, using gzip compression can reduce the transmission quality by 60%.
4. Login page redirect cache
Mobile web pages redirect the user to a different url, so using a 302 redirect with a cache live time of the same day can speed up page load times for the next time a visitor tries to load the site. It should include the user agent. This technique can only be used by mobile users. Device visitor redirection.
5. Use CDN
CDN (Content Delivery Network) is a collection of web services distributed in multiple locations that can provide content to users more efficiently. Choosing a specific content server is usually based on measuring the network closest to the user. For example, when you use CDN hosting, you can load data from different servers based on the visitor's region.
Due to lack of time and file organization, this article only talks about how to speed up the website from the perspective of the server. In subsequent articles, I will give you a detailed introduction from the aspects of content elements, CSS, JS and pictures, etc. Continued.
The original article is published by the webmaster of: http://www.mybaiduSEO.cn/news-2-1.html . The original article is A5. Please keep the valid link address when reprinting.
(Editor in charge: momo) Personal space of author mybaiduseocn