如何根据GTMatrix解决此"expiration not specified"问题?



我有一个网站WeeTech solution。每当我在">GT Matrix"上查看我的网站时,都会向我显示问题的数量,例如...... • https://www.weetechsolution.com/css/content_slider_style.css(未指定过期时间(

如何解决这个问题?

您必须将此代码添加到htaccess文件中。

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>

如果你的网站是html和php,那么你可以使用带有以下代码的.htaccess文件,并将这个.htaccess文件上传到主根目录。

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>

如果你的网站在.Net中,那么你可以在Web.config文件中使用staticContent下面给出的代码

<staticContent>
<clientCache cacheControlCustom="public" cacheControlMaxAge="24:00:00" cacheControlMode="UseMaxAge" />
</staticContent>

相关内容

  • 没有找到相关文章

最新更新