phplaravelroutesnavbarlaravel-11

Laravel Links and route not work on server


I'm using laravel 11, everything working ok on localhost, but after upload on server all navbar links not work all pages not found , only home page working.

<ul class="navbar-nav ms-auto">
    <li class="nav-item"><a class="nav-link" href="/">Home</a></li>
    <li class="nav-item"><a class="nav-link" href="{{ route('services') }}">Services</a></li>
    <li class="nav-item"><a class="nav-link" href="/login">Login</a></li>
    <li class="nav-item"><a class="nav-link" href="/register">Register</a></li>
</ul>

and this web.php

Route::get('/', [HomeController::class, 'index'])->name('home');
Route::get('/services', [ServiceController::class, 'index'])->name('services');
Route::get('/login', [UserController::class, 'login'])->name('login');
Route::get('/register', [UserController::class, 'register'])->name('register');
Route::middleware('auth')->group(function () {
    Route::get('/dashboard', [UserController::class, 'dashboard'])->name('dashboard');
    Route::get('/orders', [OrderController::class, 'index'])->name('orders');
    Route::post('/orders', [OrderController::class, 'store'])->name('orders.store');
    Route::get('/invoices', [OrderController::class, 'invoices'])->name('invoices');
    Route::get('/funds', [UserController::class, 'funds'])->name('funds');
    Route::post('/funds', [UserController::class, 'addFunds'])->name('funds.add');
});

all page files in resources/views

index.blade.php
dashboard.blade.php
home.blade.php
services.blade.php

all links on navbar get Not Found:

The requested URL was not found on this server.


Solution

  • Have you changed the APP_URL in the .env file?