htaccess浏览器缓存无法正常工作:Laravel

时间:2016-09-01 08:03:17

标签: php .htaccess caching laravel-5

我已经检查了显示48/100的谷歌页面速度,并且在htaccess中实现缓存后,页面速度相同。请告诉我是否需要在此文件或其他文件中添加其他内容以实现缓存。

的.htaccess

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
        <FilesMatch "\\.(js|css|woff|woff2)$">
    Header set Cache-Control "max-age=604800, public"
        </FilesMatch>

</IfModule>

1 个答案:

答案 0 :(得分:0)

对于谷歌洞察验证您需要的缓存包括要缓存的图像

示例:

curl \
-F 'access_token={access token}' \
-F 'html_source="<!doctype html><html>blah blah blah</html>"' \
-F 'published=true' \
-F 'development_mode=false' \
https://graph.facebook.com/{page-id}/instant_articles