如何解决这个问题"到期未指定"问题根据GTMatrix?

时间:2017-08-01 04:37:53

标签: css image cache-expiration unspecified-behavior

我有一个网站WeeTech Solution。每当我查看我的网站“ GT Matrix ”时,就会向我显示问题的数量,如... •https://www.weetechsolution.com/css/content_slider_style.css(未指定过期)

如何解决此问题?

2 个答案:

答案 0 :(得分:0)

您必须在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>

答案 1 :(得分:0)

如果你的网站是html&amp; 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,那么您可以在staticContent文件中使用Web.config 代码如下:

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