route codeigniter不加载页面

时间:2013-08-20 01:01:09

标签: codeigniter codeigniter-routing

我的问题是关于codeigniter的路线,我正在使用它,并为我编写路线的每个功能。当我把最后一条路线,这个不工作,它给我404错误。我不知道为什么?也许我错了路线的顺序,但我认为是对的。 这是我的路线:

 //MATCH SHARE
// route not working 
    $routes['upload_image/upload_photo'] = "upload_image/upload_photo"; 

//all route working
    //VOTATION//
    $route['auth_social/fblogin'] = "auth_social/fblogin";
    $route['votation/user_plus/(:any)'] = "votation/user_plus";
    $route['votation/user_minum/(:any)'] = "votation/user_minum";



    $route['finish_registration/(:any)/(:any)'] = "auth/activate"; // activate e-mail
    $route['auth'] = "auth"; // index auth
    $route['register'] = "auth/register";
    $route['login'] = "auth/login"; // login
    $route['logout'] = "auth/logout";
    $route['default_controller'] = "auth/register"; // register

    $route['(:any)'] = "profile/user";

    $route['404_override'] = '';

htaccess的

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

2 个答案:

答案 0 :(得分:0)

尝试:

$routes['upload_image/upload_photo/?']    = "upload_image/upload_photo";
$routes['upload_image/upload_photo/(.+)'] = "upload_image/upload_photo/$1";

如果您需要额外的uri细分,那么您现有的细分市场将无法运作。

答案 1 :(得分:0)

您的变量错误$routes它应该是$route['upload_image/upload_photo'] = "upload_image/upload_photo";