Categories
guides learning

Symlink to App Directory

When you build a web app, not all of the files related to the project or in your git repo need to be publicly accessible. You can clone the repo to the webserver, but then create a symlink to connect your Apache DocRoot (or somewhere else in an existing site’s folder structure) to point to the public/ or build/ folder of your app elsewhere on the server.

This can work for files too, but in this context, it is specifically useful for linking a whole folder. This doesn’t duplicate any content, so you don’t take up extra disk space, and you don’t have to maintain updates to two copies of files. It just maps requests on your server that land at one location to be invisibly use files at a different location. Kind of like an alias for a foldername?

ln -s /path/to/real/existingfolder /other/path/to/desired/newFolder

Note 1: The desired end-of-path folder name (newFolder above) should not already exist, but the path leading to it (/other/path/to/desired/) probably should.

Note 2: there was some discussion about whether or not relative paths work or not. Maybe try absolute paths to be safe until you know more than to need to reference this noob’s log of his attempt.

src

By bo.

I'm @boyEatsSteak in a lot of places. I have been wanting 🍕 for weeks. I like gadgets and technology and keeping notes and tips for my future self since all I can remember is that I forget things.