1

i'm trying to create a symlink between 2 folders on a server that has limited access so I can "deploy" my site.

This is the path to the git repo /home2/username/public_html_source and in there there is a folder named backend_code Instead of ftp uploading the files of backend_code into /home2/username/public_html, I would like to make a link to it.

I tried using ln but I keep getting a symlink folder inside of public_html.

So i'm trying to get /home2/username/public_html

to point to /home2/username/public_html_source/backend_code

3 Answers 3

5

First remove the /home2/username/public_html folder (after backing it up).

rm -R /home2/username/public_html

Then apply

ln -s /home2/username/public_html_source/backend_code /home2/username/public_html
1
  • @Jonathan, the source folder can't be change. when the destination path is present, then the symlink is added inside, when its not, the symlink becomes the correct folder.
    – seesoe
    Commented Nov 23, 2015 at 20:36
0

This solution works even if you don't have root privileges of server or using shared hosting...

Step:1 :: Change your config/filesystems.php

From

'links' => [
    public_path('storage') => storage_path('app/public'),
],

To

'links' => [
    base_path('public_html/storage') => storage_path('app/public'),
],

Step:2 :: Connect to SSH & Run the following commands

$ php artisan optimize
$ php artisan storage:link
$ php artisan optimize

it should work now.

-1

If I'm not mistaken you'd can't link two folders already existing.

What i'd do is save the data in backend_code and then make a symlink.

ln -s /home2/username/public_html_source/backend_code /home/username/public_html

This should create a symlink called backend_code in side of public_html_source which links to /home/username/public_html

HTH

3
  • i have full access to change/delete public_html folder. the above command made a symlink folder inside public_html called backend_code. Im trying to get that folder to be called public_html and be located one level down. i was almost able to get it with this.ln -s /home2/username/public_html_source/backend_code /home2/username/ but i need the name of the created symlink folder to be public_html
    – seesoe
    Commented Nov 23, 2015 at 3:19
  • OH okay! Then just change /home/username/public_html_source/backend_code TO /home/username/public_html_source/public_html
    – Erialos
    Commented Nov 23, 2015 at 16:03
  • If that worked out for you, i'd really appreciate it if you accepted me as the answer. :D If not, lets work it out and get it figured out.
    – Erialos
    Commented Nov 23, 2015 at 19:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.