Exclude Caching for .php Files

cdn
cache

#1

Could anyone suggest page rules to exclude .php files from caching?


#2

.php files don’t cache. Normally, they generate site pages, which aren’t cached. Unless you’ve added a Cache Everything Page Rule.


#3

Cache everything except .php

That’s what I need for page rule.


#4

.php doesn’t show up as an extension. It’s what outputs the HTML that is delivered for the URL you’re caching.

What is it you do want cached?


#5

I didn’t think that one through. Yes, .php can show up in a URL.

Try two page rules: One to match example.com/*.php that will Bypass Cache, then the next rule to match example.com/* to Cache Everything. The first rule should trigger a match and not continue to the second rule.


#6

Page rule with http://example.com/*.php and cache bypass causes redirect loop.


#7

Cache Level: Cache Everything
Origin Cache Control: On
You can set cache-control in php file that you want to bypass
PHP Page with dynamic content
cache-control: no-store, no-cache, must-revalidate
cf-cache-status: BYPASS


#8

This topic was automatically closed after 30 days. New replies are no longer allowed.