On Oct 2, 2011, at 7:23 AM, Anthony wrote: > I'm not sure about reading URLs (incoming or outgoing), but for re-writing > them, there is an example in > http://web2py.com/book/default/chapter/04#Pattern-Based-System showing a > re-write involving the query string: > > '/test/default/index?vars=\g<any>' > > Presumably if <any> could be a match of the subdomain, this would work.
Yes & no. I was confused, and my answer was confusing. As I read the code, routes_in has no access to the incoming query string (which is fine here), but any query string that it emits is appended to the incoming query string, if any. That should suffice. routes_out (used by URL()), also has no access to the outgoing query string. That's probably OK in this case, since we don't want to actually put the host in the URL. This implies that any request from a particular user must come in on that user's subdomain, or if not, there'd need to be a redirection to get it there. I think. > > Anthony > > On Saturday, October 1, 2011 6:23:10 PM UTC-4, Jonathan Lundell wrote: > On Oct 1, 2011, at 3:13 PM, Jonathan Lundell wrote: > >> On Oct 1, 2011, at 2:13 PM, Farsheed Ashouri wrote: >> >>> I think i have no problem with DNS. cause i put a * value in subdomain >>> setting of DNS and now i have access to any sub-domain i want. >>> So you say there is no way to solve this in routes.py? >> >> With the regex mode, perhaps. > > On second thought, I *think* that the regex router doesn't give you access to > the query string. So you might have to make the user part of the arg string > (part of the URL path) in order for the router to work for you.