Welcome Guest, Not a member yet? Register   Sign In
Set Default Controller under Sub-Directories in CI3
#1

Hi guys,

just wondering if any of you have encountered this issue. i was testing, running CI3 under in my local development. my current development setup, is i moved "application" and "systems" folders above the main root, the rest of the files is on under "public_html" including the main index.php and .htaccess (thats it, didn't touch anything after those). by default the application is running with the welcome message of CI3.

Then, with the changes. in the config.php i set the following:
$config['base_url'] = '';
$config['index_page'] = '';

in routes.php:
$route['default_controller'] = 'admin/welcome';

and .htaccess

<IfModule mod_rewrite.c>

  Options +FollowSymLinks
  RewriteEngine on

  # Send request via index.php

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

CI is not working anymore. Why?

Can anyone please help, how i can make default controller work under the "admin" folder.

Thanks in advanced
Reply
#2

Fast hack about your problem is making your MY_Router at app/core folder:
PHP Code:
<?php

class MY_Router extends CI_Router
{

    public function 
__construct($routing NULL)
    {
        
parent::__construct($routing);
    }

    protected function 
_set_default_controller() 
    {
        
$this->directory 'admin/';
        
parent::_set_default_controller();
    }



This way you will be able to set directory for default controller
Or you can even set
PHP Code:
<?php

class MY_Router extends CI_Router
{
    public 
$directory 'admin/';
    public function 
__construct($routing NULL)
    {
        
parent::__construct($routing);
    }

But this will affect all routes.. and its not a good idea.
Best VPS Hosting : Digital Ocean
Reply
#3

Hi sv3tli0,

so, is this bug for CI3?
Reply
#4

No, it's not a bug.

Read this thread: http://forum.codeigniter.com/thread-160.html
Reply




Theme © iAndrew 2016 - Forum software by © MyBB