简体   繁体   English

在symfony和apache中提供静态文件

[英]Serve static files in symfony and apache

I have a project in symfony and apache, also, I have a web/images folder where I store some images. 我有一个symfony和apache的项目,我也有一个web/images文件夹,我存储了一些图像。

The problem is that when I type the following url: mydomain:app_dev.php/images/myimage.png I get back this error: 问题是,当我输入以下网址时: mydomain:app_dev.php/images/myimage.png我收回此错误:

No route found for GET /images/myimage.png

Any other url works fine. 任何其他网址工作正常。

Why is this happening? 为什么会这样? why cant this just be like a plain apache website where you type in the image url and get it back? 为什么这不能像一个简单的apache网站,你输入图像网址并将其取回?

Thanks 谢谢

Links that use static content should not use app_dev.php or app.php . 使用静态内容的链接不应使用app_dev.phpapp.php This will allow it to be retrieved as if it was a 'plain apache website' or what ever web server you are using. 这将允许它被检索,就好像它是一个'普通的apache网站'或者你正在使用的网络服务器。

This should work the way you want it to. 这应该按照你想要的方式工作。

mydomain:images/myimage.png

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM