• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
URI segments null

I'm developing on Linux, and have a stable application. Now, when testing on Windows, all of my $this->uri->segment() calls are null. For example, when I visit
I get NULL when I access
. Is this a portability problem? Is there a work-around? Can the problem be related to header('Location: ') calls?

Have you run through the configuration again in the ./system/application/config/config.php and ./index.php? The problem may be that the site URL, or query protocol may be incorrect. Also, please confirm that your .htaccess file has been uploaded. By the looks of your URL, you have an .htaccess file, but some FTP clients ignore hidden files unless told not to.

$config['base_url']    = "http://localhost/";
$config['uri_protocol']    = "AUTO";

.htaccess exists, and is redirecting properly

I'm convinced that it's still reading the REQUEST_URI of / even though I'm using header to forward to /first_run. This might be more apache/php under windows kind of thing. Wouldn't the REQUEST_URI change after a header('Location: ') call?

It's probably a problem with the URI protocol. I would try each one in the list first, and see if your results change at all.


In your config.php file, there's a list of possible URI protocols for CodeIgniter to use. By default, it's set to AUTO, which doesn't always work. I would suggest trying each of the other options and seeing if a manual override works.

Just a heads up, I placed this line of code in the first file that loads in my appliation:
die($CI->uri->segment(1, 'no segment'));

On my Windows box:
Visiting / returns 'no segment'
Visiting /first_run returns 'no segment'

On my Linux box:
Visiting / returns 'no segment'
Visiting /first_run return 'first_run'

Switching to REQUEST_URI fixed the problem. Thanks.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.