# Statis assets are not loading correctly

**URL:** <https://discourse.slimframework.com/t/statis-assets-are-not-loading-correctly/3864>\
**Category:** Questions\
**Created:** [February 14, 2020, 3:34am UTC](https://discourse.slimframework.com/t/statis-assets-are-not-loading-correctly/3864 "2020-02-14T03:34:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![froston](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/froston/32/1079_2.png) [@froston](https://discourse.slimframework.com/u/froston)\
**Post date:** [February 14, 2020, 3:34am UTC](https://discourse.slimframework.com/t/statis-assets-are-not-loading-correctly/3864/1 "2020-02-14T03:34:30Z")

</div>

Hello everybody, I’m new to the Slim FW.  
Appreciate a lot your help!

I have a project which works alright, the only issue is that the static assets are not loaded correctly.

> php -S localhost:8080 -t public public/index.php

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/2X/c/cb0c42767e8681d70b5dd6464e3006008a879a4c.png)

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/2X/0/071f9fb9fc46c5a9267e3053ad1f999932830403.png)

The assets are loaded as html which causes an error in the browser.

I followed the instructions on web server configuration, configured the .htaccess both in the root and public folder, but nothing helped.  
I’m using default apache2 configuration running on Ubuntu. Is there some config I’m missing on my server in order to make it work?

I found [a solution](https://stackoverflow.com/questions/46568528/php-built-in-server-shows-index-page-instead-of-static-file) that works but I don’t think it is the best practice in Slim Framework.

Thanks for any help!

---

<div class="post-metadata">

**Author:** ![darkalchemy](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@darkalchemy](https://discourse.slimframework.com/u/darkalchemy)\
**Post date:** [February 14, 2020, 3:46am UTC](https://discourse.slimframework.com/t/statis-assets-are-not-loading-correctly/3864/2 "2020-02-14T03:46:16Z")

</div>

I’m not sure if this will solve your issue, but try starting the server from within the public folder, since it is the webroot.

---

<div class="post-metadata">

**Author:** ![tj\_gumis](https://avatars.discourse-cdn.com/v4/letter/t/c89c15/32.png) [@tj\_gumis](https://discourse.slimframework.com/u/tj_gumis)\
**Post date:** [February 14, 2020, 11:49am UTC](https://discourse.slimframework.com/t/statis-assets-are-not-loading-correctly/3864/3 "2020-02-14T11:49:23Z")

</div>

Listening at 8888 but calling 8080 ?

---

<div class="post-metadata">

**Author:** ![froston](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/froston/32/1079_2.png) [@froston](https://discourse.slimframework.com/u/froston)\
**Post date:** [February 14, 2020, 3:49pm UTC](https://discourse.slimframework.com/t/statis-assets-are-not-loading-correctly/3864/4 "2020-02-14T15:49:46Z")

</div>

My bad … I was just trying with different port and forgot to change it.  
I’ve already modified it in the post.

---

<div class="post-metadata">

**Author:** ![tj\_gumis](https://avatars.discourse-cdn.com/v4/letter/t/c89c15/32.png) [@tj\_gumis](https://discourse.slimframework.com/u/tj_gumis)\
**Post date:** [February 14, 2020, 4:12pm UTC](https://discourse.slimframework.com/t/statis-assets-are-not-loading-correctly/3864/5 "2020-02-14T16:12:46Z")

</div>

… and you’re absolutely sure your folder structure looks similar:

```
project 
    public
        - index.php
        front
            css
                - util.css
                - main.css
                vendor
                ... 

```

?  
Just by curiosity. Try with relative paths:

```
    <link rel="stylesheet" href=/front/css/util.css>
    <link rel="stylesheet" href=/front/css/main.css>
```

---

<div class="post-metadata">

**Author:** ![froston](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/froston/32/1079_2.png) [@froston](https://discourse.slimframework.com/u/froston)\
**Post date:** [February 14, 2020, 8:52pm UTC](https://discourse.slimframework.com/t/statis-assets-are-not-loading-correctly/3864/6 "2020-02-14T20:52:24Z")

</div>

Thanks @darkalchemy and @tj_gumis for your help.

But sadly neither approach has worked.

I’m sure the folder structure is OK.  
The problem does not seem to be with the code but with the server.  
When I try to load the asset in my browser like this:  
`http://localhost/project/public/front/vendor/bootstrap/css/bootstrap.min.css`  
it works.
