How to fix Serve static assets with an efficient cache policy without plugins
-
I keep getting this warning in PageSpeed. I edited the .htaccess file with the following code (which doesn’t seem to work):
# BEGIN WordPress # The directives (lines) between "BEGIN WordPress" and "END WordPress" are # dynamically generated, and should only be modified via WordPress filters. # Any changes to the directives between these markers will be overwritten. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress # BEGIN LiteSpeed # The directives (lines) between <code>BEGIN LiteSpeed</code> and <code>END LiteSpeed</code> are # dynamically generated, and should only be modified via WordPress filters. # Any changes to the directives between these markers will be overwritten. <IfModule Litespeed> SetEnv noabort 1 </IfModule> # END LiteSpeed # TN - START EXPIRES CACHE ExpiresActive On ExpiresByType text/css "access 1 month" ExpiresByType text/html "access 1 month" ExpiresByType image/gif "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType image/jpg "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/svg "access 1 year" ExpiresByType image/x-icon "access 1 year" ExpiresByType application/pdf "access 1 month" ExpiresByType application/xhtml-xml "access 1 month" ExpiresByType application/javascript "access 1 month" ExpiresByType text/x-javascript "access 1 month" ExpiresByType application/x-shockwave-flash "access 1 month" ExpiresDefault "access 1 month" # TN - END EXPIRES CACHE # TN - BEGIN Cache-Control Headers <ifModule mod_headers.c> <filesMatch "\.(ico|jpeg|jpg|png|gif|swf|pdf|svg)$"> Header set Cache-Control "public" </filesMatch> <filesMatch "\.(css)$"> Header set Cache-Control "public" </filesMatch> <filesMatch "\.(js)$"> Header set Cache-Control "private" </filesMatch> <filesMatch "\.(x?html?|php)$"> Header set Cache-Control "private, must-revalidate" </filesMatch> </ifModule> # TN - END Cache-Control Headers # TN - BEGIN Turn ETags Off FileETag None # TN - END Turn ETags Off
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to fix Serve static assets with an efficient cache policy without plugins’ is closed to new replies.