Jon, you right. If the example.com and all *.example.com prefixed
domains are mapped to the same web2py app it shouldn't really matter
if the host is rewritten. But then you have to be careful and don't
use relative urls when linking between the "prefixed" and "non-
prefixed" parts.

The rules I proposed are still a bit incorrect, as the case of not
default/public and not prefixed controllers is not handled correctly.
And the proper out routing is only possible when all prefixes are
explicitly enlisted. Here is the doctest with extended rules:
http://pastebin.com/f3969be47.

PREFIXES = ["dashboard", "forum", "tracker"]

routes_in = (('.*:https?://([a-z]+)\.example\.com:.* /(.*)', r'/init/
\1/\2'),
             ('/([a-z]+)/(.*)', r'/init/\1/\2'),
             ('/(.*)', r'/init/public/\1'))

routes_out = (('/init/public/(.*)', r'/\1'),
              ('/init/('+'|'.join(PREFIXES)+')/(.*)', r'/\2'),
              ('/init/(.*)', r'/\1'))

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to