On Mar 21, 2011, at 2:37 PM, Tom Atkins wrote: > I am designing an app with a URL structure like this: > > myapp.com/yoursitename > > 'yoursitename' is effectively an argument as there could be many sites and > users are allowed to create their own sites. But I'd like it to be 'top > level'. > > Then within yoursitename there will be URLs like this: > > myapp.com/yoursitename/dashboard > myapp.com/yoursitename/users > myapp.com/yoursitename/settings > > I have a black-list of reserved top level words (e.g. /admin /about /faq > /account etc) that are not allowed to be chosen. So the site will have > controllers to expose pages like: > > myapp.com/faq > myapp.com/about > > My question is what's the best / most efficient way to serve /yoursitename > and the associated controllers? > > (I hope that makes sense!)
What would be the mapping of, say, myapp.com/yoursitename/xyz? As a fully-expanded web2py URL? What are the app/controller/functions? If I understand your requirement correctly, the new router logic will do what you want. You'll need to specify a functions list in order to enable removal of the default function from the URL. So the expanded URL would be: myapp.com/yoursitename/users -> myapp.com/app/default/index/yoursitename/users, so you'd have request.args=['yoursitename', 'users'], and your default function would decide what to do with it. /admin and the like could be functions (like /app/default/admin), in which case you'd want to say: functions=['admin', 'about', 'faq', 'accounts', 'etc'] in the router control dict, or they can be controllers.

