Fix router & navmanager to properly handle subdirectory.

Fix router & navmanager to properly handle subdirectory.