我是Laravel的新手。我在我的localhost上创建了一个应用程序,这是正常的,但是当我将它上传到我的子域名时,它在身份验证后不会重定向到仪表板上。我已阅读许多教程的解决方案,甚至StackOverflow也没有找到任何解决方案。我检查了我的Laravel日志文件,但没有日志。请检查以下代码 我的路线。
Route::get('/', function(){
if(Auth::check())
return Redirect::route('dashboard');
else
return View::make('login');
});
Route::get('/404',array('before'=>'auth','as'=>'404','uses'=>'HomeController@showFourZeroFour'));
//
Route::get('dashboard',array('before'=>'auth','as'=>'dashboard','uses'=>'HomeController@showWelcome'));
用户身份验证 UserController.php
public function login()
{
if (Confide::user()) {
return Redirect::to('/');
} else {
return View::make(Config::get('confide::login_form'));
}
}
/**
* Attempt to do login
*
* @return Illuminate\Http\Response
*/
public function doLogin()
{
$repo = App::make('UserRepository');
$input = Input::all();
$dt = $input['email'];
if ($dt == "") {
$err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
return Redirect::action('UsersController@login')
->withInput(Input::except('password'))
->with('error', $err_msg);
}
if ($repo->login($input)) {
$deleted = User::where('email','=',$dt)->first()->deleted;
$status = User::where('email','=',$dt)->first()->status;
if ($deleted == '1' || $status == '0') {
Auth::logout();
return View::make('login')->with(array('message' => 'Account deactivated/deleted,Contact Admin!','level'=>'error'));
}
return Redirect::intended('/');
} else {
if ($repo->existsButNotConfirmed($input)) {
$err_msg = Lang::get('confide::confide.alerts.not_confirmed');
} else {
$err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
}
return Redirect::action('UsersController@login')
->withInput(Input::except('password'))
->with('error', $err_msg);
}
}
和我的.htaccess文件
# Force SSL
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
# 1 Month for most static assets
<filesMatch ".(css|jpg|jpeg|png|gif|js|ico)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteRule ^(composer|contributing|artisan) - [F,L,NC]
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
我已经用.domain.com
替换了会话文件中的域密钥请帮助我,我工作了两天。 感谢
答案 0 :(得分:0)
您尚未在路径文件中指定身份验证路由。 Auth路线应如下所示
/**
* Authentication
*/
Route::controllers([
'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController',
]);