In my case I have installed Laravel 10 in UBUNTU,
after installation, i created front and admin routes,
but there is problem with routes,
front route is working, but admin route is not working,
when I call admin route its says,
Not Found
The requested URL was not found on this server.
Apache/2.4.41 (Ubuntu) Server at localhost Port 80
php8.1 artisan –version Laravel Framework 10.15.0
php8.1 -v PHP 8.1.21 (cli) (built: Jul 8 2023 07:09:57) (NTS)
Copyright (c) The PHP Group Zend Engine v4.1.21, Copyright (c) Zend
Technologies
with Zend OPcache v8.1.21, Copyright (c), by Zend Technologies
Routes
Route::get('/', [AppHttpControllersfrontHomePageController::class,'index'])->name('home.index');
Route::get('/dashboard', [AppHttpControllersadminDashboardController::class,'index'])->name('dashboard');
Controllers
/var/www/html/laravel10/app/Http/Controllers/front/HomePageController.php
<?php
namespace AppHttpControllersfront;
use AppHttpControllersController;
use IlluminateHttpRequest;
use DB;
class HomePageController extends Controller
{
public function index()
{
return view('front.index');
}
}
?>
/var/www/html/laravel10/app/Http/Controllers/admin/DashboardController.php
<?php
namespace AppHttpControllersadmin;
use AppHttpControllersController;
use IlluminateHttpRequest;
use DB;
class DashboardController extends Controller
{
public function index()
{
return view('admin.index');
}
}
?>
Views
/var/www/html/laravel10/resources/views/front/index.blade.php
<?php
echo "Front";
?>
/var/www/html/laravel10/resources/views/admin/index.blade.php
<?php
echo "Admin";
?>
everything is perfect front URL is working fine,
https://localhost/laravel10/public
but the admin url is not working
https://localhost/laravel10/public/dashboard
when i comment front route then admin route is working
like below
//Route::get('/', [AppHttpControllersfrontHomePageController::class,'index'])->name('home.index');
Route::get('/', [AppHttpControllersadminDashboardController::class,'index'])->name('dashboard');
i don’t understand what is happening here, I also checked in Laravel Log, and there is no error,
even I checked in the apache2 log, also there is no error, I also checked the Folder permission, and all permission are correct,
please help me with this.
Thanks.