The laravel (4.2) application works fine on localhost (xampp). But after downloading to a live server, when you try to log in, it displays a blank page with the message "redirect to my home URL". It also gives a login error
Sorry for the weak English. Please help me. I am attaching my htaccess below:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Here is my controller function.
public function adminLoginCheck() {
$validation_rule = array(
'username' => array('required', 'min:5', 'max:50'),
'password' => array('required', 'min:6', 'max:50')
);
$validation = Validator::make(Input::all(), $validation_rule);
if ($validation->fails()) {
return Redirect::to('/')->withErrors($validation);
}
else {
$athentication = Auth::attempt(array('username' => Input :: get('username'), 'password' => Input :: get('password')));
if ($athentication) {
$rememberme = Input::get('remember');
if(!empty($rememberme)){
Auth::loginUsingId(Auth::user()->id,true);
}
return Redirect::intended('adminDashboard');
} else {
return Redirect::to('/')->with('authentication_error', 'Username or Password is not valid!');
}
}
}
My Auth filter is shown below:
Route::filter('auth', function(){if (Auth::guest()){
if (Request::ajax())
{
return Response::make('Unauthorized', 401);
}
else
{
return Redirect::guest('login');
} } })
All blade templates are available. I do not understand why a blank page appears with a redirect message. Even when you send login without input
username and password Here is the live URL http://noveltyshop.tech-novelty.com/ user: admin pass: pass
My route:
Route::get('/', array('as' => 'admin', 'uses' => 'UsersController@adminLoginForm'));
Route::post('/login', array('as' => 'login', 'uses' => 'UsersController@adminLoginCheck'));
Route::get('/adminDashboard', array('as' => 'adminDashboard', 'uses' => 'UsersController@adminDashboard'));
Route::get('/logout', array('as' => 'logout', 'uses' => 'UsersController@getLogOut'));
Route::get('/updateUserProfileForm', array('as' => 'updateUserProfileForm', 'uses' => 'UsersController@updateUserProfileForm'));
Route::post('/updateUserProfile', array('as' => 'updateUserProfile', 'uses' => 'UsersController@updateUserProfile'));
UsersController @adminDashboard
public function adminDashboard() {
return View::make('admin.pages.admin_dashboard')->with('title', 'AdminDashboard');
}