简体   繁体   English

Laravel 仅显示一个路由 site.com/admin 的空白页面,所有其他不存在的路由都转到 404 页面

[英]Laravel showing blank page for only one route site.com/admin, all other non existing route goes to 404 page

Problem: When i access non existing route it shows 404 page except site.com/admin , it shows blank page.问题:当我访问不存在的路由时,它显示except site.com/admin 404 页面,它显示空白页面。

my web.php file,我的web.php文件,

    Route::group(['prefix' => 'admin', 'middleware'=>'auth:admin'], function () {

        Route::POST('readnotification','NotificationController@readnotification')->name('readnotification');

        Route::GET('/home','AdminController@index')->name('admin.dashboard');
....

Full web.php file is here https://pastebin.com/embed_js/pZNmPih8完整的 web.php 文件在这里https://pastebin.com/embed_js/pZNmPih8

Tried:尝试:

1) I have seen php artisan route:list , /admin route is not exist. 1) 我见过php artisan route:list/admin路由不存在。

2) I removed all routes, and accessed a non existing route then it shows 404 page, except site.com/admin , as usual it shows blank page. 2)我删除了所有路由,并访问了一个不存在的路由,然后它显示了 404 页面, except site.com/admin ,它像往常一样显示空白页面。

3) Even i emptied the web.php file, but still /admin is blank and other urls going to 404 3)即使我清空了 web.php 文件,但 /admin 仍然是空白的,其他 urls 转到 404

I really don't know whats happening.我真的不知道发生了什么。

Make sure you have not created any directory inside public/ as same as your route name.确保您没有在public/ 中创建任何与您的路由名称相同的目录。 If you have /admin directory inside public/ then your /admin route will not work and show blank page without any error.如果您在public/ 中/admin目录,那么您的/admin路由将不起作用并显示空白页面而不会出现任何错误。 Anything inside public/ directory will not show as 404 page instead of that it will show a blank page public/目录中的任何内容都不会显示为 404 页,而是会显示为空白页

As you commented that you have below route to get work if you go to /admin正如您所评论的,如果您转到/admin ,您可以通过以下途径找到工作

     Route::get('/home','AdminController@index')->name('admin.dashboard');

Then it should be just / inside admin group , or add it as another route to get both route work那么它应该只是/在管理组内,或者将其添加为另一条路线以使两条路线都工作

    Route::get('/','AdminController@index')->name('admin.dashboard');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM