Last update at :2023-12-31,Edit by888u
Enabling browser caching means that the css and js files downloaded when the visitor visits for the first time are stored on the visitor's local computer. When the visitor visits the website for the second time, the browser does not need to download the css and js files and directly calls the local css and js files. js file to speed up the loading of web pages.
How to enable browser caching on Apache server
On the LAMP server, edit the .htaccess
file in the root directory of the website and add the following content:
## EXPIRES CACHING ## ExpiresActive On ExpiresByType 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 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 days" ## EXPIRES CACHING ##
This basically caches most of the larger files.
How to enable browser caching on Nginx server
Edit the location
section in the website's configuration file bo.moioi.com.conf
to the following content:
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ { expires 365d; }location ~* \.(pdf)$ { expires 30d; }
Then restart the nginx service service nginx restart and you're done.
Enabling browser caching on your WordPress website can improve your Google Pagespeed Test score.
Note: The content is collected from the Internet, so please make a backup of the source file before modifying it to prevent losses caused by errors in modification!
Recommended site search: check ip, java virtual host, how to check ip, server rental US high defense, registration number query, bbs registration, Wanwang free domain name, domain name error correction system, overseas virtual host, ip proxy free version,
发表评论