CodeIgniter Forums
Codeigniter URI remapping with 404 error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Codeigniter URI remapping with 404 error (/showthread.php?tid=60879)



Codeigniter URI remapping with 404 error - El Forum - 07-19-2014

[eluser]Unknown[/eluser]
Hi guys

I get 404 error on remapping codeigniter, here is my scenario:

1-I have a controller: USER 2-When my user has logged in, it will redirected to USER/DASHBOARD but I don’t have any function by name DASHBOARD in USER controller, I gave it an specific controller by name DASHBOARD but when I go to USER/DASHBOARD it gaves me 404 error…

Here is what I’ve done up to now:

1- my root .htaccess file:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
RewriteCond $1 !^(index\.php|images|css|robots\.txt)

2- my config.php changes:
Code:
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

3- my routes.php changes:
Code:
$route['user']="user";
$route['user/dashboard']="dashboard";

$route['default_controller'] = "main";
$route['404_override'] = "";

4- I have index() function in DASHBOARD controller which gives me the output text as below:
Code:
class Dashboard extends CI_Controller {

    public function index(){
        echo 'tst';
    }
}

Your help is appreciated smile


Codeigniter URI remapping with 404 error - El Forum - 07-20-2014

[eluser]InsiteFX[/eluser]
Code:
$route['user/(:any)'] = "user/$1";

// if you want to have just dashboard
$route['dashboard'] = "user/dashboard";



Codeigniter URI remapping with 404 error - El Forum - 07-20-2014

[eluser]Unknown[/eluser]
it worked! thanks!