Updated to work with Apache

Various changes to make sure it works cross domains