Question

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')

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top