利用浏览器缓存根本不起作用

时间:2016-05-24 08:31:26

标签: php apache laravel

我的.htaccess中有以下代码:

<IfModule mod_expires.c>
  ExpiresActive On
  <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    ExpiresDefault "access plus 7 days"
  </FilesMatch>
</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>


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

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

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

当我在Google Chrome中检查元素时:js和css不是从chach加载而是每次都加载新鲜。

请帮助任何人?

1 个答案:

答案 0 :(得分:1)

检查您的过期模块是否已启用:

# apachectl -M |grep 'expires'
expires_module (shared)
Syntax OK
#