fix URL handling to work in a mod_rewrite environment