Good morning I added the site to the server but I see that it does not apply the cache policy, can I add my line regarding this in the htaccess file that is in the kirby folder?
You mean this stuff?
<IfModule mod_expires.c>
ExpiresActive On
# Images
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
# Video
ExpiresByType video/mp4 "access plus 1 year"
ExpiresByType video/mpeg "access plus 1 year"
# CSS, JavaScript
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
# Others
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
</IfModule>
Then yes.
1 Like
Thank you very much for your reply, and is there a redirect from http to https in this file or do I need to add that?
I can put something like this at the end of this file for example
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.
RewriteCond %{HTTPS}s ^on(s)|off
RewriteCond http%1://%{HTTP_HOST} ^(https?://)(www.)?(.+)$
RewriteRule ^ %1%3%{REQUEST_URI} [R=301,L].
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301].
Can I add this text below to the standard htaccess file at the end? You will know this for sure, so want to make sure.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.
RewriteCond %{HTTPS}s ^on(s)|off
RewriteCond http%1://%{HTTP_HOST} ^(https?://)(www.)?(.+)$
RewriteRule ^ %1%3%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
<FilesMatch "\.(jpg|jpeg|png|webp|js|css|svg)$">
Header set Cache-Control "max-age=31536000, public"
</FilesMatch>