I'm with a problem very similar with this another question, but the solutions provided in that thread not helped me.
I made the deploy of my Laravel app to a shared hosting service using this guide (BTW, the guide is very similar to one of the answers of the linked question)
Below is my routes/web.php file
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::group(['prefix' => 'law', 'middleware' => ['ability:superadministrator,read-users|create-users']], function () {
Route::get('/search', 'LawController@showSearchView');
Route::get('/new', ['middleware' => ['permission:create-users'], 'uses' => 'LawController@showNewView']);
Route::get('/find', 'LawController@find');
Route::get('/edit/{id}', 'LawController@edit');
//region post
Route::post('/new', ['middleware' => ['permission:create-users'], 'uses' => 'LawController@store']);
Route::post('/search', ['middleware' => ['permission:read-users'], 'uses' => 'LawController@search']);
/*Route::post('/modify', ['middleware' => ['permission:create-users'], 'uses' => 'LawController@modify']);*/
//endregion
});
Route::group(['prefix' => 'user', 'middleware' => ['ability:superadministrator,read-users|create-users']], function () {
//..similar to the previous one
});
//some other route groups
The issue is, I can access the welcome page and also the login page. After authentication, I go to the home page and then the problem starts. Every other route than I try (like mydomain.net/law/search) leaves me to the home page again in some kind of infinity loop. The logout route also works fine.
Whats is strange to is that if I try a inexistent route like mydomain.net/blah, I go the the knowledge RouteNotFound/"NotFoundHttpException" of Laravel Framework.
I don't receive any error in php log or in my browser console. The javascript works fine.
I contact the support of the host service to ensure that Apache had the mod_rewrite enabled and apparently it is.
I googling for it about 3 hours and dig deeper here in SO, but anything helped me to understand the problem. Any tip?
Below is the .htacces file if it helps in any way:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
MISC:
- PHP 7.1
- Laravel 5.4
- The composer.json for reference
- I'm using the Laravel AdminLTE and the sidebar menu also does not work properly. I think that is the same problem causing the both issues.
- My .env file does not have anything special, but here is (part of) it.