Removing the Tilde (~) Character From the Address of Locally Hosted Sites on Mac OS X
Internet, Mac Add commentsI’ve been working on some sites locally on my Mac but by default the files are stored in a directory in the individuals user account called Sites and the address you’ve got to type into your browser is http://localhost/~username/etc… this annoyed me because I didn’t want to have to type the tilde character in the address and also that I had to have the files showing in a subdirectories of my user. I couldn’t be doing with it, I wanted to have addresses like ‘http://localhost/subdomain/’ and the solution of course is to use symbolic links.
The way I did it was to have various directories in the /Users/username/Sites directory as is the normal set up but to have a symbolic link for each project that I wanted to have a better looking URL for so for example if my PHP My Admin was contained in the directory /Users/username/Sites/phpma then I would create a symbolic link to the directory /Library/WebServer/Documents/ using the command…
- ln -s /Users/username/Sites/phpma /Library/WebServer/Documents/phpma
Et Voila… I can now use and bookmark a shorter and less visually offensive URL to the sites I’m working on.
Recent Comments