The application is working fine on my local machine but when the files are uploaded on to the web server, the default route doesn't seem to work but if I were to type in the URL with the controller name "http://www.example.com/dashboard" , it works.
The contents of the routes file is as follows:
<?php
return array(
'_root_' => 'dashboard', // The default route
'_404_' => 'welcome/404', // The main 404 route
);
and the log file contained the following output:
Info - 2011-07-04 16:13:15 --> Fuel\Core\Request::factory - Creating a new Request with URI = ""
Info - 2011-07-04 16:13:15 --> Fuel\Core\Request::factory - Setting main Request
Info - 2011-07-04 16:13:15 --> Fuel\Core\Request::execute - Called
Info - 2011-07-04 16:13:15 --> Fuel\Core\Request::show_404 - Called
Info - 2011-07-04 16:13:15 --> Fuel\Core\Request::factory - Creating a new Request with URI = "welcome/404"
Info - 2011-07-04 16:13:15 --> Fuel\Core\Request::execute - Called
Info - 2011-07-04 16:13:15 --> Fuel\Core\Request::execute - Loading controller \Controller_Welcome
Info - 2011-07-04 16:13:15 --> Fuel\Core\Request::execute - Calling \Controller_Welcome::before
Info - 2011-07-04 16:13:15 --> Fuel\Core\Request::active - Called
Info - 2011-07-04 16:13:15 --> Fuel\Core\Request::execute - Calling \Controller_Welcome::action_404
Info - 2011-07-04 16:13:15 --> Fuel\Core\Request::active - Called
Info - 2011-07-04 16:13:15 --> Fuel\Core\Request::execute - Calling \Controller_Welcome::after
Info - 2011-07-04 16:13:15 --> Fuel\Core\Request::active - Called
Info - 2011-07-04 16:13:15 --> Fuel\Core\Request::active - Called
Info - 2011-07-04 16:13:16 --> Fuel\Core\Request::factory - Creating a new Request with URI = ""
Info - 2011-07-04 16:13:16 --> Fuel\Core\Request::factory - Setting main Request
Info - 2011-07-04 16:13:16 --> Fuel\Core\Request::execute - Called
Info - 2011-07-04 16:13:16 --> Fuel\Core\Request::show_404 - Called
Info - 2011-07-04 16:13:16 --> Fuel\Core\Request::factory - Creating a new Request with URI = "welcome/404"
Info - 2011-07-04 16:13:16 --> Fuel\Core\Request::execute - Called
Info - 2011-07-04 16:13:16 --> Fuel\Core\Request::execute - Loading controller \Controller_Welcome
Info - 2011-07-04 16:13:16 --> Fuel\Core\Request::execute - Calling \Controller_Welcome::before
Info - 2011-07-04 16:13:16 --> Fuel\Core\Request::active - Called
Info - 2011-07-04 16:13:16 --> Fuel\Core\Request::execute - Calling \Controller_Welcome::action_404
Info - 2011-07-04 16:13:16 --> Fuel\Core\Request::active - Called
Info - 2011-07-04 16:13:16 --> Fuel\Core\Request::execute - Calling \Controller_Welcome::after
Info - 2011-07-04 16:13:16 --> Fuel\Core\Request::active - Called
Info - 2011-07-04 16:13:16 --> Fuel\Core\Request::active - Called
Please be kind enough to help me in resolving this issue. Thanks!
I wasn't able to find a key with the name "PATH_INFO" but the other keys are as follows :
[ORIG_PATH_INFO] => /index.php
[REQUEST_URI] => /
[QUERY_STRING] =>
The server is running "Red Hat Enterprise Linux Server release 5.5 (Tikanga)" with mod_rewrite enabled and I am also able to request any controller by typing the controller name and it works, it's just that the default route "_root_" doesn't work.
I have also checked the .htaccess file and it contains the same text as mentioned in the above comment.
Is that a fastcgi installation by any chance?
There are some issues with that, already in the issue tracker, and waiting for Dan to surface, he's been working on this in the past.
I was able to get the default route working by commenting out the following lines in the URI class thus forcing the function to use "REQUEST_URI" . Is there a way that we can specify the URI protocol to use as in CodeIgniter?
public static function detect()
{
if (static::$detected_uri !== null)
{
return static::$detected_uri;
}
if (\Fuel::$is_cli)
{
if ($uri = \Cli::option('uri') !== null)
{
static::$detected_uri = $uri;
}
else
{
static::$detected_uri = \Cli::option(1);
}
return static::$detected_uri;
}
// We want to use PATH_INFO if we can.
//if ( ! empty($_SERVER))
//{
// $uri = $_SERVER;
//}
//elseif (isset($_SERVER) and ! empty($_SERVER))
//{
// $uri = $_SERVER;
//}
//else
//{
if (isset($_SERVER))
{
// Some servers require 'index.php?' as the index page
// if we are using mod_rewrite or the server does not require
// the question mark, then parse the url.
if (\Config::get('index_file') != 'index.php?')
{
$uri = parse_url($_SERVER, PHP_URL_PATH);
}
else
{
$uri = $_SERVER;
}
}
else
{
throw new \Fuel_Exception('Unable to detect the URI.');
}
// Remove the base URL from the URI
$base_url = parse_url(\Config::get('base_url'), PHP_URL_PATH);
if ($uri != '' and strncmp($uri, $base_url, strlen($base_url)) === 0)
{
$uri = substr($uri, strlen($base_url));
}
// If we are using an index file (not mod_rewrite) then remove it
$index_file = \Config::get('index_file');
if ($index_file and strncmp($uri, $index_file, strlen($index_file)) === 0)
{
$uri = substr($uri, strlen($index_file));
}
// Lets split the URI up in case it containes a ?. This would
// indecate the server requires 'index.php?' and that mod_rewrite
// is not being used.
preg_match('#(.*?)\?(.*)#i', $uri, $matches);
// If there are matches then lets set set everything correctly
if ( ! empty($matches))
{
$uri = $matches[1];
$_SERVER = $matches[2];
parse_str($matches[2], $_GET);
}
//}
// Do some final clean up of the uri
static::$detected_uri = str_replace(array('//', '../'), '/', $uri);
return static::$detected_uri;
}
@netbuglk, have you able to solve this problem?
I am facing the same issue with our live server. things work well with easyphp webserver, portable webserver. but when I place it to our live server it doesn't work.
can anyone check this problem please,
here is the link of our live server: http://88.85.249.199/nj
thanks
Hello,
this is some info from the server.
fuelphp version : 1.0.1
apache : 5.3.6
for my php info:
click the link below for reference:
http://88.85.249.199/nj/p.php
now try to access this using the link below and it works
http://88.85.249.199/nj/index.php/
but removing the last '/' from the index.php it doesn't work.
http://88.85.249.199/nj/index.php
actually what I want is simply get rid of index.php which I followed the procedure/examples but it doesn't work. but having the codeigniter version it works well, without any issue at all.
http://88.85.249.199/apc
the above is codeigniter version.
so hope anyone could help me out so I could test my webapp.
big thanks!