Many stationmaster uses the virtual host to make the website, the webpage content once many, the website opens the speed to be particularly slow, if said server, the bandwidth, the CDN this kind of tough we did not have the economic strength to do, may wish to improve the speed through the webpage code optimization way, Lu Songsong summarizes some feasible method.
1: Zoom out of JavaScript and CSS files
If your site has about 50-60% users for the first time visitors, then these people will download JavaScript and CSS If these files are very large the browser will download for a long time.
Using the compression tool can reduce JavaScript and CSS by half the file size, if you have confidence to use "command line" I highly recommend using Yahoo Yui compression, at least can improve the compression rate of 40% to 60%, if you are not understand can use Webmaster Home css\js compression tool.
2: Reduce HTTP requests
The browser takes 80% of the time to get external components, including scripts, stylesheets, images, and so on, and only 20% of the time is used to load the content, each site has many HTTP requests, and because only 2 HTTP requests can be delivered at the same time, too many requests will cause delays.
Through the YSlow can see my blog's HTTP requests, you can see JS, CSS and CSS references too many picture files, resulting in too many HTTP requests.
3: Cache pictures, CSS, and JavaScript
Whenever a new user accesses your website, pictures, CSS, and JavaScript should be cached in their browser so that their next visit is particularly fast.
Most Windows hosts are enabled by default, just set the expiration time and file type in the Control panel, and I suggest that the picture, CSS, and JavaScript time can be set to one months. For Apache Web servers, use the Mod_cache module to turn on caching. :
4: Merging CSS reference pictures
As shown, many of the site's pictures are cut into small pieces, so that there will be a lot of CSS reference images, such as the LU Songsong blog CSS on the reference to 14 pictures, Cssimages is also an important factor affecting the speed of the site.
If we merge CSS images into one, 14 HTTP requests become 1, think about what the effect would be? Its principle is to obtain the picture path through the way of CSS coordinates, each CSS tag refers to the different coordinates to obtain the different picture. We see a lot of web site CSS pictures only one, with this principle.
Do not understand also has no relationship, CSS image Merge generator This site can help you to merge CSS images, and can get the corresponding code.
5: Basic script to load only
This is the simplest, do not spend time, click on their own site right-click "View source Files" to find the area between
For example, the LU Songsong blog references the Jiathis (social sharing button) and util.js (back to the top, write a comment shortcut tag), let it last load, this can improve the speed of content opening, and they are not very important.
6: Compress the image
Unless you load the video, then the impact of the site speed is the culprit should be the picture, if it is JPEG, PNG pictures, to ensure that the premise of quality without losing, let them try to compress, fireworks Software "Export Wizard" function, it provides a good way to preview the saved image, To balance the image size to the quality, most other image editing software has similar functionality.
For example, each of my blog posts with the "Export Wizard" function, I try to compress the image within 30K, to a certain extent, speed up the browsing speed, but also some of the picture distortion, can not see clearly.
7: Open gzip Module
Gzip compression is a very popular data compression format, the general Web site gzip enabled, the compression rate will have a 70%-80% increase, the effect is immediate.
Some virtual host default has gzip function, but most do not, independent host, VPS can be set up, open gzip will aggravate the burden of server, and to modify the server configuration, we strongly recommend that you open gzip, if not clear can ask where the space quotient, let them help open.