Welcome Guest, Not a member yet? Register   Sign In
Cache doesn't work for me as I expected -> enable_query_strings = TRUE
#1

[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";    
$config['enable_query_strings'] = TRUE;
$config['directory_trigger'] = 'd';
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';

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
#2

[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
#3

[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
#4

[eluser]Randy Casburn[/eluser]
Ah...ok thanks for that update and glad you got things sorted out.




Theme © iAndrew 2016 - Forum software by © MyBB