query: Refactor tokenFileName
query: Fix trailing slash redirect