GiantJelly GiantJelly - 1 year ago 101
HTML Question

Symfony 3 cant find my .svg icons

I have recently installed symfony 3 on a fresh Ubuntu server, I was previously using WAMP to run my symfony website but now I have migrated.

Everything is up and running except on one of my pages I have some .svg icons to show the weather.
These icons are getting a 404 error.

I have made sure they are in the correct location and I havent changed any of the html that links to them from the windows version which works fine.

They are located in web>icons>weather

My img tag

<img src="icons/weather/{{ item.icon }}.svg" />

is using twig to grab from my weather rss feed.

That outputs
GET 404 (Not Found)
in inspect and I cannot access it by going to that url manually.

Is there a .htaccess problem which causes my images to not be located correctly?

Answer Source

Alright, I found the answer.

I had a thought (like the one in my comment) that Symfony might be looking for/use a folder named "icons" in the web folder in its own way.

Whether this is the case or not I don't know but I moved the icons into a vendor folder. The address is now vendor/icons/weather/cloud.svg and IT WORKS!

So I guess what we can learn from this is either its a stupid error from me which I still don't know about or you can't use a folder called "icons" in the web folder.

Thanks for you help Alvin

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download