Any query like SELECT COUNT(*) from (SELECT COUNT(*) FROM ...) will fail with 'No column name was specified for column 1 of '_tmp'', so I'm providing an alias for the subquery's field
1. Handle hyphen -> underscore replacement of the app name early in map_app(), so the application can be identified and its routing rules used (if they exist). Without this, the rewriter fails to find the application with the hyphen in place, and reverts to the default.
2. Disable underscore -> hyphen mapping of app name when creating static URLs, as they will be invalid paths