Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

aquatimer2000's avatar

laravel 11 - route "dashboard" alway redirect to "dashboard"

Hello to everyone and sorry for my english. I just install laravel 11 project with Brezee

I would like to create a dashboard area and I would like to have all the custom sub-routes in the the file:

bootstrap/app.php

1 ) I edit it, following the documents online,

2 ) I remove the dashboord route in the file: routes/web.php

3 ) I add the files: routes/dashboard.php app/Http/Controllers/DashboardController.php

but every time in the browser i call: mysite.test/dashboard

the address is redirect to mysite.test/dashboard/ (with the / at the end) and I have a white page with a 403 error

is the route "/dashboard" a reserved routes and I can't use it?

Thank You for any help !

0 likes
14 replies
tykus's avatar

Without seeing your code, it is impossible to know how you have replaced the Breeze dashboard with your own route.

1 like
aquatimer2000's avatar

this is how I edit the file: bootstrap/app.php

->withRouting(
    web: __DIR__.'/../routes/web.php',
    commands: __DIR__.'/../routes/console.php',
    health: '/up',

    then: function () {

        Route::middleware('web')
            ->prefix('dashboard')
            ->name('dashboard.')
            ->group(base_path('routes/dashboard.php'));

    },

)

this is the file: routes/dashboard.php

use App\Http\Controllers\DashboardController;
use Illuminate\Support\Facades\Route;
Route::get('/', [DashboardController::class, 'index']); //without middleware Auth  .. for test..
martinbean's avatar

@aquatimer2000 Run php artisan route:list --path=dashboard -vvv to see what routes are registered with that prefix, and what middleware is applied. As a 403 error is an authorisation error.

aquatimer2000's avatar
C:\phpProject\lara11_a4>php artisan route:list --path=dashboard -vvv

  GET|HEAD       dashboard .................................................................................... DashboardController@index
                 ⇂ web

                                                                                                                       Showing [1] routes
tykus's avatar

You did not name your new dashboard route, so it's name will be dashboard., which is not the same as the dashboard route name registered originally by Breeze. Therefore, you will need to name your route and address any usages of (redirections to) the original dashboard route.

The 403 is a different issue however; did you cache your routes earlier in the development process?

aquatimer2000's avatar

so now I edit bootstrap/app.php but the error 403 is always on

    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        commands: __DIR__.'/../routes/console.php',
        health: '/up',

        then: function () {

            Route::middleware('web')
                ->prefix('dashboard')
                ->name('dashboard')
                ->group(base_path('routes/dashboard.php'));

        },

I don't know if I cache your routes earlier in the development process. How can clear that cache?

martinbean's avatar

I don't know if I cache your routes earlier in the development process. How can clear that cache?

@aquatimer2000 php artisan route:clear

tykus's avatar

@aquatimer2000 based on the code you are sharing, I don't think you understand what you're doing, or why. So... why are you doing this? What is it intended to achieve?

aquatimer2000's avatar

@tykus oh Yes, I'm a really newbie to Laravel and Php

I would like to create an area for autenticated users, with all the route under /dashboard

aquatimer2000's avatar

php artisan route:clear

ok, and after I run: php artisan route:list --path=dashboard -vvv same result as the post above.

With the new bootstrap/app.php file, if I open the Chrome console, I see document / rediretc "403 Forbidden (from disk cache)"

Snapey's avatar

I don't understand why you are doing all this?

If you look at the headers for the redirect in the browser console you will see where you are being redirected to

Snapey's avatar

@aquatimer2000 perhaps you have middleware applied in the controller also.

As a first step, I WOULD NOT mess about implementing a separate routes file. Just implement a route group with the authentication you need and a route prefix for /dashboard, and put these in the web.php file.

aquatimer2000's avatar

@Snapey ok, If I understand the better solution is implement a route group with the authentication I need and a route prefix for /dashboard, and put these in the web.php file (but in the same file I have a lot of routes (more than 100 ?!?) and use of different Controllers) rather than edit the file bootstrap/app.php and use more different files for routes. Can You confirm ? Thank You a lot @ everyone for help and patience!!

Now I solved my Error 403. in the public folder exist a folder named "dashboard" .... ahhhhhh

Please or to participate in this conversation.