support apps in subfolders

handle if an single page app is installed into a subfolder and has urls like e.g. http://example.com/app/#!/page