How to optimize the files and resources of a website ?, Website file resource optimization

Source: Internet
Author: User

How to optimize the files and resources of a website ?, Website file resource optimization

1. file merging (to reduce http requests): When css sprites is used to merge images, small icons and small images are often used to beautify a website, but unfortunately these small images occupy a large number of HTTP requests, therefore, sprites can be used to merge all images into one image. You can use related tools to merge images online or in ps.

2. Use CDN (Content Delivery Network) acceleration to reduce the communication distance.

3. Add the Expire/Cache-Control header to use the Cache.

4. Enable Gzip compression.

JavaScript and css compression can be performed through dynamic scripts on the server, or the apache server can be used in the root directory of the website. add the following code to htaccess: AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/json

Header append Vary Accept-Encoding

This Code indicates that the compression module of the server is called to perform GZIP compression before the above files are output. After gzip compression, all files should be able to reduce the volume by more than 30%. Especially for blogs that use a large number of js resources, the speed can be improved a lot after gzip escort.

5. Place css on the top of the page.

6. Place the script at the bottom of the page.

7. Avoid using expressions in css.

8. Place css and js in external files.

9. Reduce DNS queries.

10. File compression: Minimize css and js and reduce the file size.

11. Avoid redirection.

12. Remove duplicate scripts.

13. Configure the object tag ETag.

14. Use AJAX cache to load and update website content in batches.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.