0
我是Laravel中較新的。我在我的本地主機上創建了一個應用程序,這個應用程序工作正常,但是當我將其上傳到我的子域時,它不會在身份驗證後在儀表板上重定向。我已經閱讀了許多教程甚至StackOverflow的解決方案,但沒有找到任何解決方案。我檢查了我的Laravel日誌文件,但沒有日誌。請檢查以下代碼 我的路線。laravel 4.2 auth在服務器子域中不起作用?
Route::get('/', function(){
if(Auth::check())
return Redirect::route('dashboard');
else
return View::make('login');
});
Route::get('/404',array('before'=>'auth','as'=>'404','uses'=>'[email protected]'));
//
Route::get('dashboard',array('before'=>'auth','as'=>'dashboard','uses'=>'[email protected]'));
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('[email protected]')
->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('[email protected]')
->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
請幫助我最近兩天正在爲此工作。 謝謝
你爲什麼新Laravel但在一個過時的版本創建新的應用程序? – ceejayoz