Weird White Screen on Laravel Routes ("/")

802 Views Asked by At

From the title itself, I have a weird Laravel bug. I have test page for my home page which has a route name of "main". It works perfectly fine. However, when I tried to change it from route::get("main") to route::get("/") I end up with a white page. No errors, when I view source, no code or whatsoever. I am running Laravel 5.6

// Landing Page actual Route
// White Page 

Route::get('/', function () {
    return view('templates.landing-blank');
});

// Landing Page
// Works Perfectly.

Route::get('main', function() {
    return view('templates.landing-blank');
});

Is this something related to htaccess? I already doubled checked everything and copied the htaccess but still no avail. I also did a composer update and the problems still persist.

2

There are 2 best solutions below

2
GMachado On

The first parameter of the Route::get should be the the url path to access the page, so "main" would be accessed by example.com/main and "/" would be just example.com. Could that be the problem?

2
Cayo Henrique Rodrigues On

Can you go to .env and change the label APP_DEBUG to "true"? Maybe you can see the error.

And I think you need to add a "/" to the "main" route. Like that:

Route::get('/main', function() {
    return view('templates.landing-blank');
});