0
votes

I have uploaded my laravel project on shared hosting and my images will not work.

I have added .htaccess in the root directory and every thing works file except images. My .htaccess file is below.

RewriteEngine On
RewriteBase /
RewriteRule ^$ public/index.php [L]
RewriteRule ^((?!public/).*)$ public/$1 [L,NC]

My image link is mydomain.com/storage/facilities/May2017/BYKdbdIQCezQ6Gsh05EK.jpg

and it shows You don't have permission to access /public/storage/facilities/May2017/BYKdbdIQCezQ6Gsh05EK.jpg on this server.403 ERROR Is this symlink error? I do not have ssh access so is there any way to link storage folder?

2

2 Answers

2
votes

Here is the simple solution you can create symlink using cron job what you have to do is.

1) php (absolute path to artisan) storage:link

like php /home/(yourusername)/public_html/artisan storage:link

OR

2) ln -s /home/(yourusername)/public_html/storage/app/public/ /home/(yourusername)/public_html/public

go to public folder and rename public to storage.

1
votes

Two things:

1) I recommend you put your images in your assets folder

2) It's common knowledge that Laravel doesn't like you having access to your Storage folder. You can change permissions for it, if need be, but I highly recommend you know what you're doing before you decide what to set it to.