Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

moumene's avatar

Access denied for images on shared hosting

I have been skating for more than three days with the deployment of my site designed with Laravel8 on OVH perso2014 which is a shared hosting, without SSH. My config is as follows:

/home /user/ ->my-project/ (the entire laravel project except the contents of the public/ folder export to www/ ,then the public/ folder has been deleted.) | ->www/ __ .htaccess |__ index.php |__ storage (a symbolic link: one of the bases of my problem).

content of my 'htaccess is:

Options -MultiViews -Indexes
Options +FollowSymLinks 
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

The 'index.php' file has been configured correctly, and I have no problem whatsoever. As for the creation of the Symbolic Link, as I have no SSH on the chosen offer, I followed several methods, with the same result (403):

1- First method, Creating a route:

Route::get('/linker', function () { $exitCode = Artisan::call('storage:link'); });

Then I modified in the ‘config/filesystem.php’:

'links' => [ '/home/user/www/storage' => '/home/user/++project++/storage/app/public', ],

then I called the route ‘/linke’r, and the file storage(link) was created pointing to the desired file, with no image displayed ...

The second Method, I create a 'linker.php' file in www/:

echo shell_exec('ln -s /home/user++/proj++/storage/app/public /home/user++/www/storage');

The storage(symlink) file was created in www/ but with the same problem.

3.Current method, I modified 'www/linker.php' file with a relative path:

echo shell_exec('ln -s ../storage/app/public storage');

of course by first deleting the existing 'www/storage' ... same result.

Also the file permissions are: www/storage : 777 /home/user/proj/storage/app/public : 777 then i set it to 755

the server is an apache 2.4, and I'm in shared hosting, Thank you for your help.

0 likes
3 replies
jlrdw's avatar

Have you tried making an image folder in public and serve them with asset helper.

<img src="{{ asset('upload/imgdogs') . '/' . $row->dogpic }}" alt="" class="image">

Just example.

3 likes
moumene's avatar

thank u for ur reply, by "making an image folder in public" you mean in "www/" , yes i did it and it works

Please or to participate in this conversation.