I use hostinger and I have two folders in my parent hosting directory
in public/index.php I changed
require __DIR__.'/../vendor/autoload.php';
to require __DIR__.'/../my-laravel-app-folder/vendor/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
to $app = require_once __DIR__.'/../my-laravel-app-folder/bootstrap/app.php';
in public/.htaccess file I changed
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
Options +FollowSymLinks
# 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
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^ index.php [L]
</IfModule>
From parent / directory ,I have already run
ln -s my-laravel-app-folder/storage/app/public public_html/storage
But I still cannot access to linked storage files and got 404
error.
Finally I found the solution, it's when creating a symlink ,I have to include absolute path for folders instead of current path .For example,
my-laravel-app-folder/storage/app/public
replaced with /home/u440262284/domains/mysite.com/my-laravel-app-folder/storage/app/public
instead andpublic_html/storage
replaced with /home/u440262284/domains/mysite.com/public_html/storage
It worked !!!