Change Web Sharing "Sites" folder to SkyDrive? I'm building a web site. There are three Macs that I commonly use for development, depending upon my location: an iMac in San Diego, and iMac in Vegas, and a MacBook Air in all other places. As I move from place to place, I have to copy the contents of the  "[username]/Sites" folder from machine to machine so I can get my work done. It would be nice if I could just keep a master copy of the site files in one place.

So I signed up for the free cloud-based Skydrive storage. The pointer to the storage lives at "[username]/documents/SkyDrive". Anything inside that folder syncs across all of my Macs. Which leads me to my question…

How can I change the path that local web hosting uses (on OSX 10.8.2) to point to my SkyDrive folder instead of the default "[username]/sites"?

The goal is that when I navigate to "http://127.0.0.1/~[username]/index.html", the built-in OSX web server will pull in the index.html file from a SkyDrive folder. Hope this makes sense.

It's important to note that I won't actually be attempting to run a production website off of SkyDrive. No external users will be using the site in this manner. This is just to make my development processes a bit easier.
Yes, you can change your web server's user-specific directory to point to another location within your home directory.  Be aware there are security implications when doing this &ndash; aim to understand what they are before you proceed.

First, back up the configuration files mentioned below, then, use Terminal to edit the files as root; e.g. via sudo vi [filename].


Edit /etc/apache2/extra/httpd-userdir.conf, changing the UserDir value from 'Sites' to the new target folder within the home directory structure.  Note: This directive changes the Sites folder location for all users .. I'll assume there's just you and this is OK.
Edit the corresponding user-specific configuration file in /etc/apache2/users/[username].conf so the path mentioned in the Directory directive matches what you set above. This ensures the options that were originally being applied to your Sites folder will be applied to the new location.
Ensure permissions to the new folder (including directories leading to it) are permissive enough for the web server process to access.
Restart the apache web server; i.e. sudo apachectl restart


That should get it working.