我有一个网站WeeTech Solution。每当我查看我的网站“ GT Matrix ”时,就会向我显示问题的数量,如... •https://www.weetechsolution.com/css/content_slider_style.css(未指定过期)
如何解决此问题?
答案 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>