404 error laravel 4 routing

我与影子孤独终老i 提交于 2020-01-04 01:29:05

问题


I am having troubles getting laravel to find a page when I route to it. My route is setup and being recognized as when I create link using URL::route('account-create') laravel will successfully parse that into '/account/create' as to where I want the link to go to. But upon clicking it I get a 404 error.

My route

Route::get('/account/create', array(
     'as' => 'account-create',
     'uses' => 'AccountController@getCreate'
 ));

My controller

 class AccountController extends BaseController {


    // view the create user form
    public function getCreate() 
    {
        //return View::make('account.create');
    }


}

The create.blade.php is created and put inside an account folder under app/views. commenting or uncommenting makes no difference. The 404 remains.

I have also tried:

    Route::get('/account/create', function()
{
    return 'Hello World';
});

in my routes.php still the 404 remains

Is there some configuration I am missing?


回答1:


After looking around some more I discovered I needed to enable rewrite_module on apache. Makes perfect sense really, how can laravel make clean urls if it cant rewrite the url. I knew it was going to be something simple to fix.

Thanks a lot for your replys




回答2:


Does navigating to index.php/account/create work? If so, it is probably an error in your root-level .htaccess file, or in your VirtualHost settings in httpd.conf on your server. Post the contents of .htaccess from app/public.



来源:https://stackoverflow.com/questions/26570147/404-error-laravel-4-routing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!