Allow map_hyphen to work for application names

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
Update rewrite.py
Merge pull request #562 from timnyborg/patch-2

Enable map_hyphen to work for application names