You Are Here: Home » Uncategorized
Laravel: How to disable web.php Route and redirect everything?
Advertisement
In order to redirect everything on web routes, you can add the following piece of code in your app's route/web.php file
Route::any( '{catchall}', function(){
// return redirect( 'https://digitizor.com' )
// OR, Do something here
})->where( 'catchall', '.*' );
In order to complete disable the web.php routes and just use Laravel for API, you need to comment out the following section in the boot() method under the RouteServiceProvider class in the app/Providers/RouteServiceProvider.php file.
// Do not want any web routes
// Route::middleware('web')
// ->namespace($this->namespace)
// ->group(base_path('routes/web.php'));
Advertisement