htaccess文件(bootstrap)无法正常工作

时间:2017-03-18 21:07:11

标签: twitter-bootstrap .htaccess

我是论坛的新手。我刚刚完成了一个网站。我已将我的网站放在gtmetrix中并获得了95%/ 92%的分数非常好,但现在又因为"添加Expires标题"而再次下降。和"利用浏览器缓存"。奇怪,因为我还没有改变我的.htaccess文件。任何人都可以帮助我解决我在.htaccess文件中出错的问题。



ExpiresActive On
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/plain "access plus 1 month"
ExpiresByType application/x-javascript "access plus 2 weeks"
ExpiresByType text/css "access plus 2 weeks"
ExpiresByType text/html "access plus 2 weeks" 
ExpiresByType assets/bootstrap/js/bootstrap.js "access plus 2592000 seconds"
ExpiresByType assets/gallery/jquery.blueimp-gallery.min.js "access plus 2592000 seconds"
ExpiresByType assets/jquery.js "access plus 2592000 seconds"
ExpiresByType assets/mobile/touchSwipe.min.js "access plus 2592000 seconds"
ExpiresByType assets/respond/respond.js "access plus 2592000 seconds"
ExpiresByType assets/script.js "access plus 2592000 seconds"
ExpiresByType assets/wow/wow.min.js "access plus 2592000 seconds"

<IfModule mod_deflate.c>
 AddOutputFilterByType DEFLATE application/javascript
 AddOutputFilterByType DEFLATE application/rss+xml
 AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
 AddOutputFilterByType DEFLATE application/x-font
 AddOutputFilterByType DEFLATE application/x-font-opentype
 AddOutputFilterByType DEFLATE application/x-font-otf
 AddOutputFilterByType DEFLATE application/x-font-truetype
 AddOutputFilterByType DEFLATE application/x-font-ttf
 AddOutputFilterByType DEFLATE application/x-javascript
 AddOutputFilterByType DEFLATE application/xhtml+xml
 AddOutputFilterByType DEFLATE application/xml
 AddOutputFilterByType DEFLATE font/opentype
 AddOutputFilterByType DEFLATE font/otf
 AddOutputFilterByType DEFLATE font/ttf
 AddOutputFilterByType DEFLATE image/svg+xml
 AddOutputFilterByType DEFLATE image/x-icon
 AddOutputFilterByType DEFLATE text/css
 AddOutputFilterByType DEFLATE text/html
 AddOutputFilterByType DEFLATE text/javascript
 AddOutputFilterByType DEFLATE text/plain
 AddOutputFilterByType DEFLATE text/xml
</IfModule>

<ifModule mod_headers.c>
  <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
    Header set Cache-Control "public"
  </filesMatch>
  <filesMatch "\.(css)$">
    Header set Cache-Control "public"
  </filesMatch>
  <filesMatch "\.(js)$">
    Header set Cache-Control "private"
  </filesMatch>
  <filesMatch "\.(x?html?|php)$">
    Header set Cache-Control "private, must-revalidate"
  </filesMatch>
</ifModule>

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 2500000 seconds"
ExpiresByType image/jpeg "access plus 2500000 seconds"
ExpiresByType image/png "access plus 2500000 seconds"
ExpiresByType image/gif "access plus 2500000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2500000 seconds"
ExpiresByType text/css "access plus 600000 seconds"
ExpiresByType text/javascript "access plus 200000 seconds"
ExpiresByType application/javascript "access plus 200000 seconds"
ExpiresByType application/x-javascript "access plus 200000 seconds"
ExpiresByType text/html "access plus 600 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
ExpiresByType www.google-analytics.com/analytics.js "access plus 2592000 seconds"
ExpiresByType assets/bootstrap/js/bootstrap.js "access plus 1 year"
ExpiresByType assets/gallery/jquery.blueimp-gallery.min.js "access plus 1 year"
ExpiresByType assets/jquery.js "access plus 1 year"
ExpiresByType assets/mobile/touchSwipe.min.js "access plus 1 year"
ExpiresByType assets/respond/respond.js "access plus 1 year"
ExpiresByType assets/script.js "access plus 1 year"
ExpiresByType assets/wow/wow.min.js "access plus 1 year"
ExpiresByType assets/animate/animate.css "access plus 1 year"
ExpiresByType assets/animate/set.css "access plus 1 year"
ExpiresByType assets/bootstrap/css/bootstrap.min.css "access plus 1 year"
ExpiresByType assets/gallery/blueimp-gallery.min.css "access plus 1 year"
ExpiresByType assets/style.css "access plus 1 year"
</IfModule>
&#13;
&#13;
&#13;

0 个答案:

没有答案