Optimizing the loading speed of the site can not only improve its search engine rankings, but also reduce the site bounce rate, improve its conversion rate, but also provide a better end-user experience, which is today based on the success of the Web environment key.
I'll show you a few simple ways to optimize the speed of your Web site loading, and take a look.
1. Server Response Time
Even if the site is optimized, it will not have much effect unless the server responds very quickly. When it comes to improving the speed of the website, the server response time plays an important role. Here are some tips to improve server response times.
- Have a separate server instead of a shared/managed server.
- Improve the quality of your Web server .
- Remove unnecessary plugins, only those necessary plugins need to remain enabled.
2. Browser cache
Browser Caching can reduce HTTP requests, which in turn increases the load speed of your Web site. Here's how to use the browser cache for code examples:
<ifmodule mod_expires.c>expiresactive onexpiresbytype image/jpg "Access 1 Year" Expiresbytype image/jpeg "Access 1 Year ' Expiresbytype image/gif ' access 1 year ' Expiresbytype image/png ' access 1 year ' Expiresbytype text/css ' access 1 month ' Expiresbytype text/html "Access 1 month" Expiresbytype application/pdf "Access 1 month" Expiresbytype text/x- JavaScript "Access 1 month" Expiresbytype Application/x-shockwave-flash "Access 1 month" Expiresbytype Image/x-icon "Access 1 Year" ExpiresDefault "Access 1 month" </IfModule>
Note: If the expiration time is linked to a file and the contents of the file need to be changed, the file must be renamed so that the browser can get the newly added code.
3.gzip compression
Gzip compression is a compression utility that we can use to quickly load websites. It works by compressing the file size before sending HTML and CSS files to an Internet browser. To allow the Mod_defalte module to enable gzip compression, here is a code example of how to use it:
<ifmodule mod_deflate.c># Compress HTML, CSS, JavaScript, Text, Xmladdoutputfilterbytype deflate application /javascript addoutputfilterbytype DEFLATE application/xhtml+xml Addoutputfilterbytype DEFLATE application/xmladdoutputfilterbytype DEFLATE text/cssaddoutputfilterbytype DEFLATE Text/htmladdoutputfilterbytype DEFLATE text/javascriptaddoutputfilterbytype DEFLATE text/ Plainaddoutputfilterbytype DEFLATE text/xml# Remove Browser bugs (only needed for really old browsers) Browsermatch ^mozill A/4 Gzip-only-text/htmlbrowsermatch ^mozilla/4\.0[678] No-gzipbrowsermatch \bmsie!no-gzip!gzip-only-text/ HTMLheader append Vary user-agent</ifmodule>
4. Asynchronous scripting
There is also an awesome choice that can improve the speed of your site's pages by loading scripts asynchronously. As a result, the Web page load does not have to rely on these asynchronous scripts, and site visitors no longer have to have to restrain their patience, waiting for all scripts to be loaded before they can render the page. In asynchronous mode, scripts are downloaded in the background. In general, we will use third-party scripts as asynchronous scripts, because downloading these scripts often makes the site very slow.
<script Async src= "Http://www.yoursite.com/script.js" ></script>
5. Content distribution Network (CDN)
A Content distribution network (CDN) is a network of servers located in different geographic locations. Each server has a copy of the file for all sites. If a site visitor requests files and pages, it can be sent directly from the nearest Web server (or from the server with the least load).
6. Optimize JavaScript, HTML, and CSS
Optimizing JavaScript and CSS can also improve the speed of a Web site, and this is a very simple method. Optimizing JavaScript, HTML, and CSS removes all unnecessary whitespace and comments, reducing file size. Here are some of the most popular tools for minimizing JavaScript and CSS, which are useful.
- CSS Minifier
- Avivo
- HTML Compressor
7. The top style sheet and the script at the bottom
Putting the stylesheet on top helps the site to load quickly, because it allows the Web page to be rendered incrementally. Generally, all Internet browsers support downloading two components (images, styles, and scripts) in parallel at a given time. However, in general, the overbearing script will block other downloads when it is downloaded in parallel, until the script is downloaded.
8. Avoid blocking JavaScript and CSS
Before a browser renders a Web page, it first needs to construct a DOM tree by parsing the HTML markup language. In this process, if a script is encountered, the process is aborted and the script is executed before the previous activity is resumed. It is recommended that you avoid blocking JavaScript, especially external scripts.
Blocking JavaScript can also cause a Web site to be delayed. So you might want to postpone loading those unimportant JavaScript, or use asynchronous loading. Another option is to embed these HTML code on your Web site, and you need to ensure that the CSS is optimized.
Latency resolution for 9.JavaScript
In order to load the Web page, the browser must parse all the <script> tag content, thus increasing the load time of the website. By delaying parsing the script, you can reduce the load time of the initial Web site .
10. Enable Keep Alive
When a user requests a Web page through a browser, the browser first needs to access the HTML file. It can then read these files and request to be associated with other materials (the data here may be css,javascript or any related image).
If the "Keep Alive" option is banned, the process of downloading the Web site usually increases, which slows down the website. Another benefit of enabling keepalive is that it can reduce CPU usage.
Syntax: KeepAlive on
11. Images and file formats
Images are very valuable to any website because it conveys some powerful information to visitors to the site. The most common image formats are GIF, JPEG, PNG, and so on. Each of these formats has its strengths and limitations. It is recommended that you use the JPEG format instead of GIF and PNG images unless the image contains an alpha factor or is transparent.
12. Optimize code: Do not use inline CSS
Inline styles do not clearly separate the content from the design. At the same time may also need a lot of maintenance work, to the webmaster inconvenience, but also further increase the size of the page.
13. File Separation
The files of the website can be divided into CSS, javascripts and images. File separation does not directly improve the load time of the site. However, this can improve the stability of the server, especially when the site traffic suddenly appear spikes. Subdomains can also be used for managed files, which can increase the number of concurrent downloads.
14. Minimizing HTTP Requests
There is also a simple way to optimize page speed by reducing the HTTP request. When a Web site receives too many HTTP requests at a time, its visitors have an experience of responding to a delay, which not only increases the CPU usage but also increases the load time of the page. So, how do you reduce the HTTP request? Please see the steps below.
- Reduce the number of objects on your site.
- Minimize The number of redirects on the site .
- Use CSS sprites technology (as long as you need that part of the picture content).
- Combine javascripts and CSS.
The above recommendations have proven to be very effective in optimizing the page loading speed of your website. In short, dazzling graphics, interesting content and better navigation can help you get more site visitors, but faster page loading speeds can help you keep them.
Source: Codeceo
14 Tips for optimizing web site loading speed