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

marcor's avatar

The site loads, but my styles aren't working

Hi All,

I checked the other posts related to this but it seems that their problems are different than mine. So I will be asking it away:

I have added a fresh project in Laravel and run the command php artisan make:auth... did the migrations, etc.

When i run php artisan serve and I copy the path to the browser, everything works as expected e.g. http://localhost:portnumber But when I try to load the project directly from my localhost (wamp\www\project) e.g. http://localhost/MyLaravelProject/Public/index.php It runs but without any styles to it.

I have other non-laravel projects in the same directory and they are working fine.

Can you please shed the light on what could be the problem?

Thank you

0 likes
11 replies
RonB1985's avatar

Are you including any styles manually? If so, how?

Try doing it like this instead if you aren't doing this already:

<link href="{{ asset('css/style.css') }}" rel="stylesheet">
marcor's avatar

Hi Ron,

I used Laravel project out of the box, I haven't done anything else yet from my part.

Downloaded Laravel from composer, created a new project, run php artisan make:auth, did the migrations and run the project.

The error doesn't seem to be with what you suggested though, because when I run php artisan serve and copy paste the url into my browser.. it works

codenex's avatar

It has to be something with your WAMP configuration. I don't use WAMP so I can't tell you what but it has to be the culprit.

Since you are loading laravel project using the URL http://localhost/MyLaravelProject/Public/index.php my guess would be that it's not finding your assets correctly. You should be serving your site from the public directory and your not.

1 like
marcor's avatar

Hi codenex,

I am actually serving my project from the public directory; I have other projects working fine in this directory. And I followed the files in the project pointed out by the bootstrap files; it's finding the assets correctly.

Any other suggestion?

Snapey's avatar

Your url is wrong, which means your document root is wrong, which means anything with / at the start of the path will point to the wrong place.

You say your path is http://localhost/MyLaravelProject/Public/index.php

well Public should be your document root. In the above, the folder above MyLaravelProject is the root.

Just fix your wamp config and all will be fine.

1 like
RonB1985's avatar
RonB1985
Best Answer
Level 18

Just press F12 and check where the browser is trying to find the css files, then you will know what is wrong.

1 like
marcor's avatar

@codenex & @Snapey I am sorry, I didn't mean the MyLaravelProject/public; what I meant was the wamp public folder.. My bad

@RonB1985 Thank you for the help; I actually found out that it's trying to read from /css/app.css but what it is supposed to do, is read from ../css/app.css. Funny thing because when i run php artisan serve and use the given url... it works !!

Thanks loads for the help guys

Snapey's avatar

You are not listening...

Funny thing because when i run php artisan serve and use the given url... it works !!

because when you run php artisan serve, the public folder is served as the document root (and I mean the Laravel public folder)

So anything that starts with / will be grounded in that public folder whereas when you use WAMP, when you start with / you are saying that the CSS folder is in the wamp public directory.

your ../ccs/app.css works then the url is like /posts but will break when your url is /posts/1/edit because then it will look for css in /posts/1/css

Fix the document root and everything else will fall into place.

2 likes
marcor's avatar

@Snapey how can I listen when you are writing...:D ?

I am new to this forum, bear with me a bit my friend. I appreciate your answers and they were helpful in so many ways. I learned from them about the difference in the directories serving and how php artisan serve really works.

I appreciate you help Thank you

Snapey's avatar

we're all here to learn..

1 like

Please or to participate in this conversation.