Status: Not fixed.
When Leverage Browser Cache is enabled with default ’90’ days to expiration, I understand plugin should setting up caching policy for the static files only
and never for text/html content.
But it add…
ExpiresByType text/html "access 3 month"
… in following code block.
# AMPFORWPLBROWSERCSTART Browser Caching
<IfModule mod_expires.c>
ExpiresActive On
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType image/svg+xml .svg
ExpiresByType application/vnd.ms-fontobject "access 1 year"
ExpiresByType application/x-font-ttf "access 1 year"
ExpiresByType application/x-font-opentype "access 1 year"
ExpiresByType application/x-font-woff "access 1 year"
ExpiresByType image/svg+xml "access 1 year"
ExpiresByType image/webp "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType text/css "access 3 month"
ExpiresByType text/javascript "access 3 month"
ExpiresByType text/html "access 3 month"
ExpiresByType application/javascript "access 3 month"
ExpiresByType application/x-javascript "access 3 month"
ExpiresByType application/xhtml-xml "access 3 month"
ExpiresByType application/pdf "access 3 month"
ExpiresByType application/x-shockwave-flash "access 3 month"
ExpiresDefault "access 3 month"
</IfModule>
# END Caching AMPFORWPLBROWSERCEND
As a result, it output (https://i.imgur.com/rD4tbwy.png)
Request URL: https://localhost/
Request Method: GET
Status Code: 200 OK
Remote Address: [::1]:80
Referrer Policy: strict-origin-when-cross-origin
Cache-Control: max-age=7776000
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
Date: Wed, 30 Dec 2020 10:17:21 GMT
Expires: Tue, 30 Mar 2021 10:17:21 GMT
Keep-Alive: timeout=5, max=100
Link: <https://localhost/wp-json/>; rel="https://api.w.org/"
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1h PHP/7.4.13
Transfer-Encoding: chunked
X-Powered-By: PHP/7.4.13
reload the page clicking logo
Request URL: https://localhost/
Request Method: GET
Status Code: 200 OK (from disk cache) <------ #Noticed?
Remote Address: [::1]:80
Referrer Policy: strict-origin-when-cross-origin
Cache-Control: max-age=7776000
Content-Type: text/html; charset=UTF-8
Date: Wed, 30 Dec 2020 10:21:28 GMT
Expires: Tue, 30 Mar 2021 10:21:28 GMT
Link: <https://localhost/wp-json/>; rel="https://api.w.org/"
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1h PHP/7.4.13
X-Powered-By: PHP/7.4.13
happening because Cache-Control: max-age=7776000
for text/html.
What is expected?
Cache-Control: max-age=0
for text/html via below code
ExpiresByType text/html "access plus 0 seconds"
or just avoid this entire mess by removing ExpiresByType text/html "access 3 month"
and this one ExpiresDefault "access 3 month"
. After then only static files will have your user input (For example, 90) settings.
— Error 500 —
– Just keep enabled Leverage Browser Cache
– Now, try changing the value like I have done
https://youtu.be/3Ykz0SlkJTs
[Wed Dec 30 16:02:20.647562 2020] [core:alert] [pid 760:tid 1840] [client ::1:63188] C:/xampp/htdocs/.htaccess: 'ExpiresByType text/css access 3 month days': bad expires code, numeric value expected <num> 'days', referer: https://localhost/wp-admin/options-permalink.php
# AMPFORWPLBROWSERCSTART Browser Caching
<IfModule mod_expires.c>
ExpiresActive On
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType image/svg+xml .svg
ExpiresByType application/vnd.ms-fontobject "access 1 year"
ExpiresByType application/x-font-ttf "access 1 year"
ExpiresByType application/x-font-opentype "access 1 year"
ExpiresByType application/x-font-woff "access 1 year"
ExpiresByType image/svg+xml "access 1 year"
ExpiresByType image/webp "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType text/css "access 3 month days"
ExpiresByType text/javascript "access 3 month days"
ExpiresByType text/html "access 3 month days"
ExpiresByType application/javascript "access 3 month days"
ExpiresByType application/x-javascript "access 3 month days"
ExpiresByType application/xhtml-xml "access 3 month days"
ExpiresByType application/pdf "access 3 month days"
ExpiresByType application/x-shockwave-flash "access 3 month days"
ExpiresDefault "access 3 month days"
</IfModule>
# END Caching AMPFORWPLBROWSERCEND
Temp to fix, I modified
Find 3 month days
Replace to 3 month 0 days
-
This reply was modified 3 years, 10 months ago by Gulshan Kumar. Reason: added more details