Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter routes for user and admin interfaces
#1

[eluser]AM-Info[/eluser]

I'm creating a website using Codeigniter, and I want to have an admin interface and a user interface.

I am using this aproach

> controller/
-admin/dashboard.php
-admin.php ( loads admin/login.php view )
-dasboard.php

> models/
-admin/

> views/
-admin/dashboard.php, login.php
-dasboardh.php, login.php

Ok if I go to example.com/admin it works, it loads the login view, but If I want to go to example.com/admin/dashboard it doesn't load.. says page not found

I've tried adding to the routes the following route['admin/dashboard']='admin/dashboard'; but it continues not to work. Also in my url's I have always the index.php and I can't take it off with htacess, here is my htaccess:

php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Every help would be aprecciated, thanks a lot!


Codeigniter Developers
#2

[eluser]InsiteFX[/eluser]
Routes - ./application/config/routes.php
Code:
$route['dashboard/(:any)'] = 'admin/dashboard/$1';

$route['login'] = 'admin/login';

1) Use dashboard for your url.
2) Use login for your url.

Your .htaccess is also wrong.
Code:
php_value default_charset utf-8

Options FollowSymLinks
Options -Indexes
DirectoryIndex index.php

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

Remove index.php - ./application/config/config.php
Code:
$config['base_url'] = '';




Theme © iAndrew 2016 - Forum software by © MyBB