Zend keep front controller from blocking image requests

荒凉一梦 提交于 2019-12-11 19:49:01

问题


Anytime I use an <img> tag in my Zend Framework application, no image is displayed. When I type the absolute path into the address bar, the front controller attempts to find an "images" controller.

There HAS to be a way I can use <img src="/public/images/logo.png"> in Zend Framework right?

I've tried it from within views, layouts, and helpers, and no luck. I've also used the $this->baseURL() technique, and the serverURL() technique by getting the info from the Front Controller, but it still won't show the image... anywhere on the site. (I have the same problem with including css files unless I do an @import('/css/main.css')


回答1:


Sounds like an problem with your .htaccess file you have to exclude this files from the reWrite rule, otherwise those requests are routed to index.php.

/public/.htaccess

RewriteEngine on
RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ index.php


来源:https://stackoverflow.com/questions/10442338/zend-keep-front-controller-from-blocking-image-requests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!