Cloudflare caches files with extension html for static content. But when visiting the root of a website, eg http://foo.com there is no extension specified, thus this page is not cached as static html. How can I tell Cloudflare to cache the homepage without an extension?

Obviously I could use Apache's htaccess to force traffic from http://foo.com to http://foo.com/index.html but that means my server will be hit to execute this redirect, and that's exactly what I want to avoid.


You simply use the explicit url as the page rule. Such as http://foo.com/.

  • But then everything will be cached, including all pages that fall under foo.com/blaba etc. – bart Jan 22 '18 at 8:15
  • @bart that is incorrect. Only a wildcard rule would do that, such as foo.com/* – Jules Jan 23 '18 at 0:01
  • Also @bart - cloiudflare does not cache pages as static content. Even HTML. Unless you explicitly do so with a page rule. This is because any file extension can be driven through a pre processor on the server depending on the configuration. – Jules Jan 23 '18 at 0:05
  • Fair enough, but question remains, will a page rule at root level be applied to all subfolders? – bart Jan 23 '18 at 23:20
  • If you use the wildcard character, yes: foo.com/* – Jules Jan 24 '18 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.