2014-02-11 152 views
0

我用于分组控制器路线和使用该URL之后限定的Route控制器路由的Laravel通配符?

http://localhost/alachiq/public/admin/profile 

它可以显示轮廓图。但是,如果用户输入:

http://localhost/alachiq/public/admin/profile/ 

重定向到http://localhost/admin/profile,我得到这个错误:

Not Found 

The requested URL /admin/profile was not found on this server. 
Apache/2.4.6 (Debian) Server at localhost Port 80 

如何在控制器中使用通配符?

我的路线:

Route::group(array('prefix'=> 'admin' ,'before'=>'auth'), function(){ 
    Route::controller('profile', 'ProfileController',array('getIndex'=>'profile.index', 'postUpdate'=>'profile.update')); 

}); 

回答

0

我猜你的DocumentRoot应该是/路径/到/ alachiq /公开的,但是如果你想留下来它是如何在这里,你必须修改htaccess的取子文件夹考虑在内。
它看起来像这样RewriteRule ^(.*)/$ /alachiq/public/$1 [L,R=301]

+0

感谢,但我想重定向到'管理/配置文件' –

0

如果我明白了,你正在寻找这样的:

class UserController extends BaseController { 

    function __construct() { 
     $this->beforeFilter('auth', array('except' => array('store', 'update'))); 
     $this->beforeFilter('csrf', array('on' => 'post')); 
    } 
} 

你可以找到更多的代码:Laravel 4 except filter in controller constructor