dongxin5429 2017-09-22 23:52
浏览 182
已采纳

我怎么能禁用缓存,特定的PHP文件?

I am currently working on a WordPress powered ecommerce website, where the chosen shopping platform is WooCommerce.

Is there a way, without using a Plugin, which will allow me to prevent browsers from Caching certain php files? In this instance, the 'header.php' and 'cart.php' files? My assumption would be, that some tinkering to the '.htacess' file would be required but then I could be wrong.

  • 写回答

2条回答 默认 最新

  • dongren4099 2017-11-15 16:17
    关注

    I found out the issue. I completely overlooked/forgot, I had the below Caching Code in the .htaccess file. School Boy error!

    Once I removed the below code, the Basket Caching Problem was resolved.

    ## EXPIRES CACHING ##
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/pdf "access plus 1 month"
    ExpiresByType text/x-javascript "access plus 1 month"
    ExpiresByType application/x-shockwave-flash "access plus 1 month"
    ExpiresByType image/x-icon "access plus 1 year"
    ExpiresDefault "access plus 2 days"
    </IfModule>
    ## EXPIRES CACHING ##
    

    Should I discover a way to cache a website, without the Basket being Cached, I will add it to this answer.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献