Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

404 error in / login Laravel

I migrate a web page made in Laravel to a server witch Cpanel, all the routes are working find except the Auths like /login. When you try to enter there route it appear a 404 error. Here is the page: http://elgloborojocatalogos.com.mx/

And my routes are :

<?php

Auth::routes();

// Routes or function calls for this project.
Route::get('/', 'GlobosController@catalogo');

Route::get('globos',['uses' =>'GlobosController@index']);

Route::post('globos/store',['uses' =>'GlobosController@store'])->middleware('auth');

Route::get('globos/retrieveall',['uses' => 'GlobosController@retrieveAll'])->middleware('auth');

Route::get('globos/retrieve/{no_pages}',['uses'=> 'GlobosController@retrieve'])->middleware('auth');

Route::get('globos/pages',['uses'=>'GlobosController@pages'])->middleware('auth');

Route::get('globos/pagesp/{type}', ['uses' =>'GlobosController@pagesp'])->middleware('auth');   

Route::get('/home', function(){ return redirect('globos/pages');});

Route::delete('globos/deleteGlobo/{id}', ['uses' =>'GlobosController@deleteGlobo'])->middleware('auth');

Route::post('globos/findGlobo',['uses'=>'GlobosController@findGlobo'])->middleware('auth');

Route::get('globos/imprimirCatalogo',['uses'=>'GlobosController@imprimirCatalogo'])->middleware('auth');

//Users
// Authentication Routes...
Route::get('login', 'Auth\LoginController@showLoginForm');
Route::post('login', 'Auth\LoginController@login');
Route::post('logout', 'Auth\LoginController@logout');
like image 885
Ana María González Avatar asked Dec 05 '22 16:12

Ana María González


1 Answers

You are trying to access http://elgloborojocatalogos.com.mx/login , But it shows file not found. which is pretty obvious, because you are missing index.php before login like below

http://elgloborojocatalogos.com.mx/index.php/login

Now it will do the trick, but sure it looks ugly. So for removing index.php you need to add a .htaccess file in the public_html folder, which is root. So, simply create a file and name it .htaccess and copy paste this following line of code to the file.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase //
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?$1 [L]
</IfModule>

It should work as expected now

like image 156
Afikur Rahman Avatar answered Dec 26 '22 12:12

Afikur Rahman