Fixed error with directories

Only the character directory was working. It appears the others now have a different base URL, so added global variable for new base URL and changed base URL reference in function.