Creating a folder shortcut in Infinityfree

I am having a problem creating a shortcut folder. I am trying to host a Laravel project. I looked at these methods to get rid of /public in the URL .

And it works but now I am having a issue creating a shortcut folder of storage in the public folder to access the uploaded content publicly. Using FTP client when I tried to upload a shortcut folder it uploads the whole original location folder.

Any suggestions would be appreciated.

This sounds like an issue from a few weeks ago. Does this answer your question?

3 Likes

Thanks admin for the reply.
Yeah I get that I cannot create a shortcut folder here. But I solved that issue. Here’s how:

Why do we need a shortcut in Laravel in the first place??

Because the files that we upload are stored in the storage folder which cannot be accessed publicly. So we created the shortcut of storage in the public folder to access them.

How about we directly save the files in the public directly. By default, Laravel store files in the storage but we can change that in config/filesystems.php .

Just change this

‘local’ => [
‘driver’ => ‘local’,
‘root’ => storage_path(‘app’),
],
‘public’ => [
‘driver’ => ‘local’,
‘root’ => storage_path(‘app/public’),
‘url’ => env(‘APP_URL’) . ‘/storage’,
‘visibility’ => ‘public’,
],

to this.

‘local’ => [
‘driver’ => ‘local’,
‘root’ => public_path(‘storage’),
],
‘public’ => [
‘driver’ => ‘local’,
‘root’ => public_path(‘storage’),
‘url’ => env(‘APP_URL’) . ‘/storage’,
‘visibility’ => ‘public’,
],

Now the storage is changed to public directory. No need to change anything in controller. Now anything you upload should be uploaded in public/storage/.... directory.

And the issue is solved.

4 Likes

That sounds like a great way to work around this restriction. Thank you for sharing!

2 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.