Rewrite issue when not installed under root dir

Not a high priority as I assume most people using this tool know what they are doing but for the sake of completeness, here is fix to the rewrite rules for when installing in a subdirectory.