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

Pixelairport's avatar

Routes cached in local

Hi. I have two problems and maybe they are connected.

  1. My routes are cached, even im in a local environment. Does anything changed in laravel 10?

  2. I have a route shown when i do php artisan route:list, but when I call the domain I get 404. It shows blog/{page} ... but when i call mylaravelurl.com/blog/test123 ... i get 404.

Maybe someone have an idea,... because i dont know what else i can do. thx.

0 likes
9 replies
LaryAI's avatar
Level 58

For the first problem, you can clear the route cache by running the following command in your terminal:

php artisan route:clear

For the second problem, make sure that the route is defined correctly in your routes file. Check that the URL you are trying to access matches the route definition exactly. Also, make sure that there are no conflicting routes that may be causing the 404 error.

Snapey's avatar

make sure you have a post with slug of test123

1 like
Pixelairport's avatar

@Snapey Yes,... i removed something (/seperator/) from domain and then every parameter moved and the page was not found anymore... thx.

Pixelairport's avatar

First problem solved thx to @snapey ... does anyone know why i need to clear cache, config and routes when im in local environment? Could it be because I use CACHE_DRIVER=redis? I need it for tagging feature. Or what else can i do?

Pixelairport's avatar

@Snapey Sorry. I just find more information, about what you mean? Im just not sure, when does laravel start to use cache for it? I have projects, where routes are loaded everytime and projects where I have to do php artisan route:clear before. I thought it depens on environment. But it seem it doesnt. When I switch back to file from redis I get the info "This cache store does not support tagging.". Can I disable it? I saw all the cache stores in config/cache.php, but there is no "none" or a similar one I could choose.

Snapey's avatar
Snapey
Best Answer
Level 122

@Pixelairport you will normally need a cache, and you can choose the most appropriate cache for your environment.

You can choose to store the routes in cache with the artisan route:cache or artisan optimise commands

The point being you should NOT use either of these commands in development because then when you make changes to the routes, they will not take effect until you clear cache or re-cache

1 like
Pixelairport's avatar

@Snape Thx... I also found the problem, ... I was a bit confused, why this is acting not like my other laravel projects... it was a bug in a middleware i created. ... Thx for your help @snapey

Vakho's avatar

use php artisan optimize:clear so you do not have to clear cache every time

Please or to participate in this conversation.