php - "Laravel Route Redirects to Deleted View Despite Clearing Cache and Restarting Server" - Stack Overflow

I just started learning Laravel, and I faced an issue. I made two view files. The first one is home.bla

I just started learning Laravel, and I faced an issue. I made two view files. The first one is home.blade.php and the second one is welcome.blade.php. In the routes folder, web.php, I used the Route::redirect('/home', '/welcome'); redirect method, which redirects me to the welcome file. When I write in the localhost URL like this http://127.0.0.1:8000/home, it correctly redirects me to the welcome view page, and the URL changes to http://127.0.0.1:8000/welcome. But then I removed the redirect method code and also deleted the welcome view page, yet it still redirects me to the welcome page when I write home in the URL. I asked ChatGPT, and it told me to run the PHP artisan commands to clear the cache and the view. I did exactly the same, but after this, I still face the same issue. When I write home in the URL, it redirects me to the welcome page, which doesn’t even exist and shows a 404 error.

I want that when I write home in the URL, it opens the home.php file and not redirects me to the welcome.php file, which doesn’t even exist.

I just started learning Laravel, and I faced an issue. I made two view files. The first one is home.blade.php and the second one is welcome.blade.php. In the routes folder, web.php, I used the Route::redirect('/home', '/welcome'); redirect method, which redirects me to the welcome file. When I write in the localhost URL like this http://127.0.0.1:8000/home, it correctly redirects me to the welcome view page, and the URL changes to http://127.0.0.1:8000/welcome. But then I removed the redirect method code and also deleted the welcome view page, yet it still redirects me to the welcome page when I write home in the URL. I asked ChatGPT, and it told me to run the PHP artisan commands to clear the cache and the view. I did exactly the same, but after this, I still face the same issue. When I write home in the URL, it redirects me to the welcome page, which doesn’t even exist and shows a 404 error.

I want that when I write home in the URL, it opens the home.php file and not redirects me to the welcome.php file, which doesn’t even exist.

Share Improve this question edited Jan 18 at 2:40 skdishansachin 7245 silver badges21 bronze badges asked Jan 17 at 17:48 Muhammad ShehrozMuhammad Shehroz 12 bronze badges 5
  • Can you try this in another browser, or by appending a query string to the URL? I'm just guessing, but browsers are notorious for "remember" redirects – Chris Haas Commented Jan 17 at 18:35
  • Hello Muhammad, you would need to share some portion of code related to this as we do not have visibility over the issue you are facing. – Olumuyiwa Commented Jan 17 at 18:36
  • Can you share the exact commands you tried? You haven't mentioned clearing the route cache so you could try that too. Also check your storage/framework/views, storage/framework/cache and bootstrap/cache folders in case there are any persistent files in there that should be deleted as well (assuming this is indeed a caching issue and there's nothing else going on) – apokryfos Commented Jan 17 at 18:57
  • @ChrisHass yes I tried in both Chrome and Microsoft edge browser and also restart my pc but the issue does not resolve. – – Muhammad Shehroz Commented Jan 18 at 9:56
  • @Olumuyiwa sure i write this [127.0.0.1:8000/home] in url which redirects to welcome page the code I write in the web.php is Route::redirect('/home', '/welcome'); and in welcome page i simply write welcome message – Muhammad Shehroz Commented Jan 18 at 10:01
Add a comment  | 

1 Answer 1

Reset to default 0

Just clear browser cache. I faced same problem and fixed by clearing browser data.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745351211a4623843.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信