Cache doesn't work for me as I expected -> enable_query_strings = TRUE - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Cache doesn't work for me as I expected -> enable_query_strings = TRUE (/showthread.php?tid=10167) |
Cache doesn't work for me as I expected -> enable_query_strings = TRUE - El Forum - 07-21-2008 [eluser]ckissi[/eluser] Hello, I tried cache but it doesn't work for me as it should. Here is my config: Code: $config['uri_protocol'] = "AUTO"; I use mod_rewrite so my URL : index.html is rewrited to index.php?c=homepage&m=homepage_show When I cache this page, every page I access on my site will return the same home page that was just cached. I tried to go through code and found this in system/libraries/output.php: Code: $uri = $CI->config->item('base_url').$CI->config->item('index_page').CI->uri->uri_string(); I made a little test and my CI->uri->uri_string() is empty ... so every page is cached as /index.php and query_string is simply ignored so : index.php?c=homepage&m=homepage_show is cached as index.php and every other page is also cached as index.php Cache doesn't work for me as I expected -> enable_query_strings = TRUE - El Forum - 07-21-2008 [eluser]Randy Casburn[/eluser] Hi ckissi, You can't combine both query_strings and URI segmentation features. This is a great observation and you've done a great job at tracking down the potential problem. Unfortunately, once you turned on query strings, you turned off most of the really convenient features that go along with all the URI segmentation. Here is the warning from the documentation: Quote:Please note: If you are using query strings you will have to build your own URLs, rather than utilizing the URL helpers (and other helpers that generate URLs, like some of the form helpers) as these are designed to work with segment based URLs. So I think the problem is that CI->uri->uri_string() is empty because you've enabled query strings. Hope this helps, Randy Cache doesn't work for me as I expected -> enable_query_strings = TRUE - El Forum - 07-21-2008 [eluser]ckissi[/eluser] I figured it out ... I use combination: enable_query_string = true and uri_protocol = 'PATH_INFO' and ables me to use mixed path_info/query_string urls Cache doesn't work for me as I expected -> enable_query_strings = TRUE - El Forum - 07-21-2008 [eluser]Randy Casburn[/eluser] Ah...ok thanks for that update and glad you got things sorted out. |