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>ExpiresactiveOnExpiresbytype 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/javascriptAddoutputfilterbytype DEFLATE Application/xhtml+xmlAddoutputfilterbytype DEFLATE Application/xmlAddoutputfilterbytype DEFLATE Text/cssAddoutputfilterbytype DEFLATE text/htmladdoutputfilterbytype DEFLATE text/javascriptaddoutputfilterbytype DEFLATE text/plain Addoutputfilterbytype DEFLATE text/xml# Remove Browser bugs (only needed for really old Browsers)Browsermatch ^moz ILLA/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.
<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.
Transferred from: http://www.codeceo.com/article/14-ways-website-page-speed.html
14 Tips for website loading speed optimization