Brian Vanderbusch
Brian Vanderbusch

Reputation: 3339

Zend keep front controller from blocking image requests

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

Upvotes: 0

Views: 628

Answers (1)

opHasNoName
opHasNoName

Reputation: 20736

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

Upvotes: 2

Related Questions