On May 27, 2012, at 9:40 AM, chinakr wrote: > I tried > ('.*http://yueche.haijia.org.* /', '/yueche/default/index'), > but nothing I expected happened. Why?
For simple domain-to-app mapping, you may find the parametric router a little easier to configure. routers = dict( domains = { "domain.com" : "app", "x.domain.com" : "appx", "domain2.com" : "app2", }, ) > > 在 2011年2月14日星期一UTC+8下午10时29分00秒,Wikus van de Merwe写道: > The syntax for url with domains is a bit more complex than what you've tried. > It's "[remote address]:[protocol]://[host]:[method] [path]". > > To make the following rewriting: > http://domain1.com/ -> http://domain1.com/d1/default/index > http://domain2.com/ctr/fcn -> http://domain2.com/d2/ctr/fcn > http://domain3.com/ctr/fcn/arg1/arg2 -> > http://domain3.com/d3/ctr/fcn/arg1/arg2 > > use these rules for routes_in: > (".*http://domain1.com.* /", "/d1/default/index"), > (".*http://domain2.com.* /", "/d2/default/index"), > (".*http://domain3.com.* /", "/d3/default/index"), > (".*http://domain1.com.* (.*)", r"/d1\1"), > (".*http://domain2.com.* (.*)", r"/d2\1"), > (".*http://domain3.com.* (.*)", r"/d3\1") > > To also get the URL created paths rewriting, for example: > http://domain1.com/d1/defualt/index -> / > http://domain1.com/d1/ctr/fcn -> /ctr/fcn > > use these rules for routes_out: > ("/(d1|d2|d3)/defualt/index", "/"), > ("/(d1|d2|d3)(.*)", r"\2")