laravel routes" /"被禁止

时间:2015-02-03 05:27:34

标签: laravel permissions routes server

我用laravel制作我的网站。 这是我的routes.php:

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::group(array('before'=>'auth'),function(){
Route::get('/', 'PostController');
});
Route::get('login','HomeController@dologin');
Route::post('login','HomeController@dologin');
Route::get('logout','HomeController@dologout');

Route::get('registration', 'HomeController@registration');
Route::post('registration', 'HomeController@registration');

Route::post('uploading', array('uses'=>'HomeController@uploading','as'=>'home.uploading'));

Route::resource('post','PostController');
Route::resource('comment','CommentController',array('except'=>array('store')));
Route::post('comment/{id}', array('uses'=>'CommentController@store','as'=>'comment.store'));
Route::resource('user','UserController');
Route::get('user/{id}/description_edit', array('uses'=>'UserController@description_edit','as'=>'user.description_edit'));
Route::put('user/{id}/description_update', array('uses'=>'UserController@description_update','as'=>'user.description_update'));
Route::get('user/{id}/password_edit', array('uses'=>'UserController@password_edit','as'=>'user.password_edit'));
Route::put('user/{id}/password_update', array('uses'=>'UserController@password_update','as'=>'user.password_update'));

如果我访问localhost / au / public,它将自动重定向到localhost / au / public / login(它确实可以在我的本地服务器上运行)

但是在我将其上传到网络主机服务器之后 当我访问rivelapark.com/au/public时,它不会自动将我重定向到rivelapark.com/au/public/login。我得到了禁止的消息。

当我访问rivelapark.com/au/public时,是否有人可以帮助我,它会自动将我重定向到rivelapark.com/au/public/login?感谢你们。

1 个答案:

答案 0 :(得分:0)

有两个可能的原因:

  1. 您需要在服务器上启用apache重写(通常使用 a2enmod重写)
  2. 允许设置AllowOverride All而不是 该虚拟主机的AllowOverride无。
  3. 此外,您应该将您的网络根目录设置为" public"这样你的php文件不在文档根目录之外。