php - Laravel 5 not loading images in subfolder -
i'm looking solution of error in laravel 5 project. have project in public_html folder, project working on except images have in subfolder.
this project structure:
- root
- laravel
- public_html
- index.php
- images
- users
- default.jpg
- users
i've got main template called workspace.blade.php, in script tag i've got js variable refer project folder image:
<!-- scripts --> <script type="text/javascript"> var url = '{{ url::asset('/'). lang::getlocale() }}/'; var resourcesurl = url + 'resources/'; var imagesurl = '{{ url::asset('images') }}'; var jsurl = '{{ url::asset('js/') }}'; </script> so in ejs javascript template printing image:
<img src="<%= imagesurl + '/users/default.jpg' %>"> but browser console show me following error:
get http://mydomain.com.co/users/default.jpg 404 (not found) if try load image "images/" folder, works good, if try load image inside of subfolder images "images/users/" doesn't work anymore.
i've printed url directly, happens nothing. wrong laravel redirects url route in route collection , throws error of routing.
i don't know if must modify .htaccess file, it:
<ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> options -multiviews </ifmodule> rewriteengine on # redirect trailing slashes... rewriterule ^(.*)/$ /$1 [l,r=301] # handle front controller... rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l] thanks me!
you missing images
<img src="<%= imagesurl + '/users/default.jpg' %>"> should be
<img src="<%= imagesurl + '/images/users/default.jpg' %>">
Comments
Post a Comment