2012-07-15 130 views
0

我已經放在一個簡單的高速緩存控制在我的.htaccess文件:緩存控制工作不正常

#cache css and javascript files for one week 
<FilesMatch ".(js|css)$"> 
Header set Cache-Control "max-age=604800" 
</FilesMatch> 

當我在谷歌的網頁網站測試儀測試的桌面網站:https://developers.google.com/speed/pagespeed/insights ...它顯示了JavaScript和圖像正在被緩存。但是,當我測試我的移動網站時,緩存不起作用。我htaccess文件包含在public_html目錄以及所有我的桌面文件我的移動網站,這裏包含(即的public_html/index.html的,的public_html /圖像/,的public_html/CSS /,的public_html /的.htaccess等。)的public_html /移動/。

我需要添加第二個.htaccess文件到移動目錄才能使它工作嗎?

謝謝。

回答

1

最好的辦法是使用HTML5樣板的.htaccess文件。它針對緩存,gzip,跨域ajax以及許多功能進行了高度優化。

另請檢查mod_deflate是否打開。

您不需要任何額外的.htaccess文件,只需在目錄的根目錄中使用單個文件即可。