Welcome Guest, Not a member yet? Register   Sign In
Caching only pages without query string
#1

Is there a way to save the cache only for pages without querystring in the url?

Example:

www.site.com/product (cache yes)

www.site.com/product?cat=4&dr=45 (cache no)

Thanks
Reply
#2

(01-27-2021, 04:22 AM)henry_miaomiao Wrote: Is there a way to save the cache only for pages without querystring in the url?

Example: 

www.site.com/product (cache yes)

www.site.com/product?cat=4&dr=45 (cache no)


PHP Code:
// app/Config/Cache

public $cacheQueryString true;


// in the controller

if (! $this->request->getGet('cat') && ! $this->request->getGet('dr')) {
    $this->cachePage(100); 


Maybe there is an easier solution.
Reply
#3

(01-27-2021, 08:27 AM)iRedds Wrote:
(01-27-2021, 04:22 AM)henry_miaomiao Wrote: Is there a way to save the cache only for pages without querystring in the url?

Example: 

www.site.com/product (cache yes)

www.site.com/product?cat=4&dr=45 (cache no)


PHP Code:
// app/Config/Cache

public $cacheQueryString true;


// in the controller

if (! $this->request->getGet('cat') && ! $this->request->getGet('dr')) {
    $this->cachePage(100); 


Maybe there is an easier solution.

Thanks; could be usefull
Reply




Theme © iAndrew 2016 - Forum software by © MyBB