Action "foo/foobar" does not exist error in Symfony
I am saving pictures under my web folder in the folder:
web/media/photo
In the template that displays the photo, I have the following snippet:
<?php echo link_to(image_tag('media/photo/filename.jpg', '@some_url); ?>
When I display the view, although the photo is displayed correctly and the link works, I get the following开发者_C百科 error in my php_errors.log file:
Action "media/photo" does not exist.
Why is symfony trying to parse the path to the image as a url?
Does anyone know how to fix this?
Add a leading slash to the image path:
<?php echo link_to(image_tag('/media/photo/filename.jpg', '@some_url); ?>
This will prevent Apache from redirecting to the media/photo
action in symfony that is matched the mod_rewrite
rules in .htaccess
.
精彩评论