doutan8506 2012-07-18 05:56
浏览 54

用户和管理界面的CodeIgniter路由

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

Im 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 followinf 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!

  • 写回答

2条回答 默认 最新

  • doufanglian7585 2012-07-18 06:05
    关注

    For user

    $route['(inbox|sent|trash)'] = "message/$1";
    $route['(settings|change_password|signout)'] = "account/$1";
    

    For admin

    $route['(inbox|sent|trash)'] = "admin/message/$1";
    $route['(settings|change_password|signout)'] = "admin/account/$1";
    

    make sure that all keys in $route should be defined in specified controller

    评论

报告相同问题?

悬赏问题

  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源