As far as I can find, you have to set up web2py routes to do this -- it's pretty easy to do redirection using routes (using routes_in), but I'm not aware of any way off-hand to do the equivalent of rewriting/ translation the URL for inbound requests (routes_out does to translation).
This is something I (and doubtless) many others need as well, and it really should be a (default enabled) option for web2py to automatically treat URL-embedded hyphens as though they were underscores for matching app, controller and function names, and an optionally enablable setting to make all generated routes use hyphens instead of underscores for apps, controllers, and functions. The open-and-shut arguments for using hyphens boil down to (in order of severity): * Underscores are obscured when URLs are underlined * Hyphens are easier to type than underscores – no need for the shift key * Hyphens are easier to read * Underscores are a typographical construction invented primarily for underlining characters (<key> <backspace> <underscore> on a typewriter), and today is used primarily in programming and other technical contexts. In short, there is little justification for exposing back-end considerations to the world. Many references can be found on this subject: * http://pylonsbook.com/en/1.1/urls-routing-and-dispatch.html#choosing-good-urls * http://semicolons.org/post/256699383/friendly-urls * http://www.wordsellinc.com/blog/content-optimization/use-hyphens-not-underscores-in-urls/ This is one of the sore points I have with anything I put on the web -- to provide what I feel is a correct URL scheme to the user, I'll bypass or override half of the backend code if necessary, which is suboptimal. Web2py is very close to making it easy to provide URLs that'll withstand the scrutiny of bloggers -- besides the hyphen bit, all I really see as being needed is: * The aforementioned settings for hyphenization. * in routes_in and routes_out add the ability to supply a function/ lambda in the second index of any inner two-tuple, which would receive a match object and return a string. For example, the following could be a stop-gap way to perform this kind of underscore-to-hyphen conversion: routes_out = ( (r'/([^/]*)/([^/]*)/([^/]*)(/?P<any>.*)?', lambda match: '/'.join(part.replace('_', '-') for part in match.groups()) + match.group('any')), ) On Aug 24, 7:47 pm, Cory Coager <ccoa...@gmail.com> wrote: > How do you use dashes in controller names? I get errors, "Invalid > request".