I create .htaccess
in root project and add this code for set expire date for css and js.
My server is Ubuntu 16.04
But this code not work for my website.
This code in htaccess:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "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"
ExpiresByType text/html "access plus 600 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
</IfModule>
<IfModule mod_headers.c>
<FilesMatch "\\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "max-age=2692000, public"
</FilesMatch>
<FilesMatch "\\.(css)$">
Header set Cache-Control "max-age=2692000, public"
</FilesMatch>
<FilesMatch "\\.(js)$">
Header set Cache-Control "max-age=216000, private"
</FilesMatch>
<FilesMatch "\\.(x?html?|php)$">
Header set Cache-Control "max-age=600, private, must-revalidate"
</FilesMatch>
Header unset ETag
Header unset Last-Modified
</IfModule>
How do I fix the problem?
Thank you
<IfModule>
wrappers - do you get an error? "My server is Ubuntu 16.04" - since you've included your.htaccess
file, I assume you are on Apache? Which version? Both your rule blocks are doing the same sort of thing - why are you using both mod_expires and mod_headers - is this code intended to work on different servers? "in Laravel" - since Laravel is a PHP framework, if you wanted to do this "in" Laravel implies you want to do this "in PHP" - but I assume that's not the case?