Leverage Browser Caching and CakePHP

后端 未结 1 981
孤城傲影
孤城傲影 2020-12-20 02:18

I asked my host if they supports mod_expires or not, they told me that it is supported. I use CakePHP and I tried the following code in webroot/.htaccess and `a

相关标签:
1条回答
  • 2020-12-20 03:16

    It seems to be a bug in cakephp. In cakePHP 1.3+ the themed view assets have been moved from app/webroot/themed/themeTitle to app/views/themed/themeTitle/webroot.

    According to CakePHP 1.3 documentation you are able to restore the old place (i.e. in the main webroot) of the themed static assets by creating app/webroot/theme/themeTitle

    Linking to static assets is slightly different from 1.2. You can still use the existing app/webroot/themed and directly link to those static files. It should be noted that you will need to use the full path to link to assets in app/webroot/themed. If you want to keep your theme assets inside app/webroot it is recommended that you rename app/webroot/themed to app/webroot/theme. This will allow you to leverage the core helper path finding. As well as keep the performance benefits of not serving assets through PHP.

    So, what I have done for solve this issue is to copying all files in app/views/themed/slate/webroot to app/webroot/theme/slate

    The following screen shot is from FireFox Firebug that shows an image file get the expire after one year in seconds:

    enter image description here

    0 讨论(0)
提交回复
热议问题