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

nmtechnology's avatar

Links to blades do not work and get message "file not found" when deployed to nginx server.

Here is my situation, only my welcome/index page only loads and displays fine when deployed onto the server then my links to the other blades produces a "page not found" error message in the browser even though I know the blade files are there in my views file located on the server.

When I was in development utilizing Valet everything worked fine, all the links to my other blades/pages work fine until deployed to my server.

I have tried to use the commands recommended in Laravel docs php artisan view:clear and then view:cache to clear out my previous cache and then cache my new blade views but still does not link to the other blades. I thought it was a permission thing and tried to change permissions and that does not resolve the issue either. I am out of options not sure why the server is not locating my other blades. I also ensured I generated an app key.

0 likes
22 replies
sr57's avatar

-1- check your routes (php artisan route:list)

-2- check your logs (laravel & web server)

1 like
jeffallen's avatar

Which host is it? And did you read the chapter on deployment?

1 like
nmtechnology's avatar

Host is Namecheap and my site is on a Digital Ocean droplet. I will look at the deployment chapter in docs a little closer. Thank you!

Tray2's avatar

Sounds to me like you are using a LAMP stack. If so make sure you have ran sudo a2enmod rewrite.

nmtechnology's avatar

Actually a LEMP. This is for my company website and I had it just as a single page site. Recently, this past week, I've expanded my services and attempted to add a page for each service.

Thanks.

sr57's avatar

the nginx deployment because the verbiage is vague,

Often the case with a new subject that deals with many new 'concepts'

The best way for you should be to setup a small web server on your local host, an maybe try apache that's a little easier to setup.

nmtechnology's avatar

web.php


Route::get('/', function () {
    return view('welcome');
});

Route::get('/structured.blade.php', function () {
    return view('structured');
});

Route::get('/fire.blade.php', function () {
    return view('fire');
});

Route::get('/cctv.blade.php', function () {
    return view('cctv');
});

Route::get('/access.blade.php', function () {
    return view('access');
});

Route::get('/home.blade.php', function () {
    return view('home');
});
lemmon's avatar

@nmtechnology

remove .blade.php from all your routes

Route::get('/structured', function () { return view('structured'); });

the server thinks you want file

1 like
nmtechnology's avatar

So like this?


Route::get('/', function () {
    return view('welcome');
});

Route::get('/structured', function () {
    return view('structured');
});

Route::get('/fire', function () {
    return view('fire');
});

Route::get('/cctv', function () {
    return view('cctv');
});

Route::get('/access', function () {
    return view('access');
});

Route::get('/home', function () {
    return view('home');
});
lemmon's avatar

yes now fix your links so they are the same as the route ie

Route::get('/structured', function () { return view('structured'); });

and the link is

<a href="/structured">Enter Site</a>
lemmon's avatar

@nmtechnology

maker sure your url's match the route ie

<a href="/structured">Enter Site</a>

and the corresponding route is

Route::get('/structured', function () { return view('structured'); });

and the structured.blade.php is in in the resources/views directory.

1 like
lemmon's avatar
lemmon
Best Answer
Level 28

@nmtechnology

you do not need to add the .blade.php when you call a route, or in the route, or when you return the view :)

1 like
lemmon's avatar

I am sorry Of this I do not know.

I recommend starting another post with that question I am sure someone will help you

:)

nmtechnology's avatar

I went through these videos and the thing is I did not see Jeffery explain how to write the html attribute for your link appropriately, or at least maybe I didn't notice it if he did, gonna go back through now that I know the the culprit. I was using PhpStorm and it hints at blades that it knows exists so my lazy butt clicked that and didn't think anything twice thinking it was the correct way to write the attribute for my link. that was my mistake.

Don't get me wrong these tutorials offer a lot of useful information but sometimes I notice little quirks can slip through the cracks and you can be left without a solution even after viewing some of these tutorials.

lemmon's avatar

@nmtechnology

If you follow those tutorials to the letter they are very complete and informative.

someidiot's avatar

put this in your nginx config,

location ~ /* { rewrite ^(.*)$ /index.php?_url=/$1; }

it should fix your problem

Please or to participate in this conversation.