# CSS loading issue

**URL:** <https://discourse.slimframework.com/t/css-loading-issue/504>\
**Category:** Questions\
**Created:** [July 14, 2016, 12:50am UTC](https://discourse.slimframework.com/t/css-loading-issue/504 "2016-07-14T00:50:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ML88](https://avatars.discourse-cdn.com/v4/letter/m/f14d63/32.png) [@ML88](https://discourse.slimframework.com/u/ML88)\
**Post date:** [July 14, 2016, 12:50am UTC](https://discourse.slimframework.com/t/css-loading-issue/504/1 "2016-07-14T00:50:55Z")

</div>

Hi,  
I am attempting to load custom CSS from a local directory, but I can’t seem to get it working. When I attempt to load the CSS from a directory relative to the template file, it doesn’t load and in the console it reports “Resource interpreted as Stylesheet but transferred with MIME type text/html: “[http://localhost:8080/site.css](http://localhost:8080/site.css)””.

With the default slim-skeleton, everything is loaded relative to the public directory, which I have tried loading relative to that as well, but no luck.

Anybody have any ideas what could be wrong?

Thanks!

---

<div class="post-metadata">

**Author:** ![johan](https://avatars.discourse-cdn.com/v4/letter/j/dec6dc/32.png) [@johan](https://discourse.slimframework.com/u/johan)\
**Post date:** [July 22, 2016, 7:58am UTC](https://discourse.slimframework.com/t/css-loading-issue/504/2 "2016-07-22T07:58:56Z")

</div>

I don’t know why, but try adding this to the start of your application.

```auto
if (PHP_SAPI === 'cli-server' && $_SERVER['SCRIPT_FILENAME'] !== __FILE__ ) { return false; }

```

---

<div class="post-metadata">

**Author:** ![JoeBengalen](https://avatars.discourse-cdn.com/v4/letter/j/b5e925/32.png) [@JoeBengalen](https://discourse.slimframework.com/u/JoeBengalen)\
**Post date:** [July 22, 2016, 3:38pm UTC](https://discourse.slimframework.com/t/css-loading-issue/504/3 "2016-07-22T15:38:00Z")

</div>

> <https://github.com/slimphp/Slim/blob/3.x/example/.htaccess#L10>

This should given direct access to files.

Also the link to a resource file must be relative to the public url (`http://localhost:8080/`), not the template.

If you go directly to `http://localhost:8080/site.css` you will probably get a not found page, which has MIME type text/html
