Welcome Guest, Not a member yet? Register   Sign In
CI in my subfolder (i put CI in subfolder) - Solved
#1

[eluser]kreamik[/eluser]
sorry if repost on thread .. but i cannot find any threads related to my problem ( or because my bad english i don't find it )

i just found some thread that has problem subfolder in controller, but i have problem about application in subfolder

i install new CI 2.0.1 to my root (www/) access it by url "http://localhost/",
it works and show welcome page from welcome controller ..

but when i move all into subfolder "project" under /www/ and error happened ..

folder position when it work:
Code:
-www
   -application
   -system
   -index.php

now that not work with no changes
Code:
-www
   -my project ( with space inside )
       -application
       -system
       -index.php

in the old 1.7.2 i can do this just by copying with no change,

what step i miss about this?


error happened is:
Code:
404 Page Not Found

The page you requested was not found.
#2

[eluser]kreamik[/eluser]
if it's bugs ..
but i found the problem why my site doesn't work ..

i found a mistake (is it bug?) in URI.php that path is system/core/URI.php on line 148

i change
Code:
$uri = $_SERVER['REQUEST_URI'];
to
Code:
$uri = urldecode($_SERVER['REQUEST_URI']);

that why CI read my controllers read as 'my project' instead of 'aplication'

function "_detect_uri" fail to detect base_url, because folder named cannot read and so cannot be removed

Code:
private function _detect_uri()
    {
        if ( ! isset($_SERVER['REQUEST_URI']))
        {
            return '';
        }

        $uri = urldecode($_SERVER['REQUEST_URI']);

        if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0)
        {
            $uri = substr($uri, strlen($_SERVER['SCRIPT_NAME']));
        }
        elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0)
        {
            $uri = substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME'])));
        }

        // This section ensures that even on servers that require the URI to be in the query string (Nginx) a correct
        // URI is found, and also fixes the QUERY_STRING server var and $_GET array.
        if (strncmp($uri, '?/', 2) === 0)
        {
            $uri = substr($uri, 2);
        }
        $parts = preg_split('#\?#i', $uri, 2);
        $uri = $parts[0];
        if (isset($parts[1]))
        {
            $_SERVER['QUERY_STRING'] = $parts[1];
            parse_str($_SERVER['QUERY_STRING'], $_GET);
        }
        else
        {
            $_SERVER['QUERY_STRING'] = '';
            $_GET = array();
        }
        
        if ($uri == '/' || empty($uri))
        {
            return '/';
        }
                
        $uri = parse_url($uri, PHP_URL_PATH);

        // Do some final cleaning of the URI and return it
        return str_replace(array('//', '../'), '/', trim($uri, '/'));
    }

for this time it's solve for me ..

Thx CI crew for your best product ..
#3

[eluser]InsiteFX[/eluser]
Did you change the paths to your system and application folders in index.php ?

InsiteFX
#4

[eluser]kreamik[/eluser]
yes changed in index.php,
but the $uri variables is always wrong since the folder has space char inside ..

before change the variable the $uri is always "my project" and CI think that this is the controller folder,
after change the $uri var, $uri become only "", so it go to default controller ..
#5

[eluser]InsiteFX[/eluser]
Change my project
to
my_project or my-project

You can not have a space in the directory name.

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB