Welcome Guest, Not a member yet? Register   Sign In
URI segments null
#1

[eluser]mscahill[/eluser]
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
Code:
http://localhost/first_run
I get NULL when I access
Code:
$this->uri->segment(1)
. Is this a portability problem? Is there a work-around? Can the problem be related to header('Location: ') calls?
#2

[eluser]TheFuzzy0ne[/eluser]
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.
#3

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

.htaccess exists, and is redirecting properly
#4

[eluser]mscahill[/eluser]
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?
#5

[eluser]TheFuzzy0ne[/eluser]
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.
#6

[eluser]mscahill[/eluser]
meaning?
#7

[eluser]TheFuzzy0ne[/eluser]
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.
#8

[eluser]mscahill[/eluser]
Just a heads up, I placed this line of code in the first file that loads in my appliation:
Code:
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'
#9

[eluser]mscahill[/eluser]
Switching to REQUEST_URI fixed the problem. Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB