是否可以在.htaccess文件中使用带有查询字符串的浏览器缓存.php文件

时间:2017-09-19 18:09:48

标签: php .htaccess caching browser-cache

我的网站加载速度在pingdom工具中太低了。它有大约65个缓存验证器错误。所以我在.htaccess文件中使用了以下代码

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access 7 days"
ExpiresByType text/cache-manifest  "access 0 seconds"
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 images/jpg "access 1 year"
ExpiresByType images/jpeg "access 1 year"
ExpiresByType images/gif "access 1 year"
ExpiresByType images/png "access 1 year"
ExpiresByType img/jpg "access 1 year"
ExpiresByType img/jpeg "access 1 year"
ExpiresByType img/gif "access 1 year"
ExpiresByType img/png "access 1 year"
ExpiresByType text/html  "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType application/x-font-ttf    "access 1 year"
ExpiresByType font/opentype             "access 1 year"
ExpiresByType application/x-font-woff   "access 1 year"
ExpiresByType image/svg+xml             "access 1 year"
ExpiresByType application/vnd.ms-fontobject "access 1 year"
</IfModule>

但它再次在php文件中显示错误,如下面的查询字符串

http://www.example.com/img.php?test=sometext&img=https://images.pexels.com/photos/56866/garden-rose-red-pink-56866.jpeg

请有人告诉我如何为上述网址格式设置缓存。

提前致谢。

0 个答案:

没有答案