sahostking Posted November 10, 2012 Share Posted November 10, 2012 Hi guys, I'm looking for the best way to score well on GTMEtrix and have my site fast. I have done the following after installing smartoptimizer in the .htaccess file, anyone got any other ideas around this or tip? # Smartoptimizer 1.8 <IfModule mod_expires.c> <FilesMatch "\.(gif|jpg|jpeg|png|swf|css|js|html?|xml|txt|ico)$"> ExpiresActive On ExpiresDefault "access plus 10 years" </FilesMatch> </IfModule> <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*\.(css))$ smartoptimizer/?$1 <IfModule mod_expires.c> RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^(.*\.(css|html?|xml|txt))$ smartoptimizer/?$1 </IfModule> <IfModule !mod_expires.c> RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^(.*\.(gif|jpg|jpeg|png|swf|css|js|html?|xml|txt|ico))$ smartoptimizer/?$1 </IfModule> </IfModule> <FilesMatch "\.(gif|jpg|jpeg|png|swf|css|js|html?|xml|txt|ico)$"> FileETag none </FilesMatch> # End Smartoptimizer 1.8 # Add future Expires <ifmodule mod_expires.c=""> ExpiresActive On ExpiresDefault "access plus 1 seconds" ExpiresByType text/html "access plus 1 seconds" ExpiresByType image/gif "access plus 2592000 seconds" ExpiresByType image/jpeg "access plus 2592000 seconds" ExpiresByType image/png "access plus 2592000 seconds" ExpiresByType text/css "access plus 604800 seconds" ExpiresByType text/javascript "access plus 216000 seconds" ExpiresByType application/x-javascript "access plus 216000 seconds" </ifmodule> # End future Expires # Cache Control Headers <ifmodule mod_headers.c=""> <filesmatch ".(ico|pdf|flv|jpg|jpeg|png|gif|swf)$"=""> Header set Cache-Control "max-age=2592000, public" </filesmatch> <filesmatch ".(css)$"=""> Header set Cache-Control "max-age=604800, public" </filesmatch> <filesmatch ".(js)$"=""> Header set Cache-Control "max-age=216000, private" </filesmatch> <filesmatch ".(xml|txt)$"=""> Header set Cache-Control "max-age=216000, public, must-revalidate" </filesmatch> <filesmatch ".(html|htm|php)$"=""> Header set Cache-Control "max-age=1, private, must-revalidate" </filesmatch> </ifmodule> # End Cache Control Headers # Turn off ETags <ifmodule mod_headers.c=""> Header unset ETag </ifmodule> FileETag None # Remove Last-Modified header <ifmodule mod_headers.c=""> Header unset Last-Modified </ifmodule> 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.