• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Codeigniter URI remapping with 404 error

#1
[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

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

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

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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.