Hi. I have two problems and maybe they are connected.
My routes are cached, even im in a local environment. Does anything changed in laravel 10?
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.
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.
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?
@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.
@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
@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