I have changed my Document Root in the MAMP settings to a folder in my Dropbox so I can easily sync my files between computers. This was fine until I started to using relative file paths, the URL was not found because it was looking in the root rather than the subdirectory that held the site files.
I've tried to set up a virtual host to solve the problem, but it seems that having set my own MAMP document root to Dropbox is not letting this happen. I added this line to the bottom of my hosts file
127.0.0.1 oip.local and I have this at the end of my Apache
NameVirtualHost * <VirtualHost *:80> DocumentRoot "/Volumes/OSX/Lara/Dropbox/Sites" ServerName localhost </VirtualHost> <VirtualHost *:80> DocumentRoot "/Volumes/OSX/Lara/Dropbox/Sites/onlyinpgh" ServerName oip.local </VirtualHost>
If I go to settings and change the document root back to
/Applications/MAMP/htdocs, the oip.local gets to the proper home page, but (as expected) everything breaks as soon as I point to a file in the root because it's in Dropbox, not htdocs. I've been restarting MAMP, clearing Cache/Cookies, restarting browsers throughout the process. I also have the Apache port set the the default, 80.
Any idea how to avoid this? Is there a better way than Dropbox to sync my site files across computers? Thanks in advance.