I have been trying to create a symlink:
/var/www -> /home/USER/code/
Following https://stackoverflow.com/questions/9104337/create-a-symbolic-link-of-directory-in-ubuntu , I entered the following command:
sudo ln -s /var/www /home/USER/code
However the result isn't what I expect. My link is stored inside the /www directory instead of linking the www directory itself. I use apache as the local web server, for my case, i have to access my code as
localhost/code/PROJECT
whereas I wish to have something like
localhost/PROJECT
The code
directory should just serve as a directory where I store all my projects.
Anything I'm missing out?
Best Answer
Delete (or move, for safety) the
www
directory before you create the symlink.So, you should have a
/var
, but there should be no/var/www
. Then, and only then, will a symlink calledwww
be created that points to your localhost/code/project folder.