I'm looking for the solution of an error in my laravel 5 project. I have my project in public_html folder, so my project is working on good except the images that I have in a subfolder.
This is my project structure:
I've got a main template called workspace.blade.php, in script tag I've got a js variable to refer my 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 a EJS Javascript template I am printing my image:
<img src="<%= imagesUrl + '/users/default.jpg' %>">
But the browser console always show me the following error:
GET http://mydomain.com.co/users/default.jpg 404 (Not Found)
If I try to load an image from "images/" folder, it works good, but If I try to load an image inside of subfolder from images like "images/users/" it doesn't work anymore.
I've printed the url directly, but it happens nothing. The wrong is laravel redirects the url to route in route collection and it throws an error of routing.
I don't know if I must modify my .htaccess file, but this is 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 for help me!
You are missing images
<img src="<%= imagesUrl + '/users/default.jpg' %>">
Should be
<img src="<%= imagesUrl + '/images/users/default.jpg' %>">
Finally I've found the error. Just my "images/users" folder and it's files inside don't have the right permissions. It had 640 permissions, so I've changed that for 644.