How to set the root of your site in a variable when the application may be started in a subfolder
use a combination of getDirectoryFromPath() and getCurrentTemplatePath() in stead of expandPath('./')
Put in your application.cfc in the onApplicationStart() the folowing line of code:
application.settings.BASEPATH = getDirectoryFromPath( getCurrentTemplatePath() );
(or any other variable name offcourse!)
+