You have to add a rule for that that redirects the route that you do not want to expose to a custom error page.
On Monday, 3 April 2017 12:06:25 UTC-5, Lisandro wrote: > > When you use parameter router system, you have the possibility to set a > dictionary mapping each domain with an app and then set > exclusive_domain=True, this way each app is accessible only through its > assigned domain. > But how to do that when using pattern routes? > > I'm serving several domains; two web2py apps for each domain. > How do I configure routes to allow access to only those two apps per > domain? > > For example, lets assume we have two domains: recipes.com and traveler.com > Each domain works with two apps: > > - recipes.com > - applications/recipes/ > - applications/recipes_panel/ > - traveler.com > - applications/traveler/ > - applications/traveler_panel/ > > > In order to get this to work, first we need routes.py in the main folder > of web2py: > > routes_app = [ > (r'.*?://recipes.com:\w* /$anything', r'recipes'), > (r'.*?://traveler.com:\w* /$anything', r'traveler') > ] > > > Then, we need applications/recipes/routes.py: > routes_in = [ > ('/', '/recipes/default/index'), > ('/robots.txt', '/recipes/static/robots.txt'), > ('/favicon.png', '/recipes/static/custom/favicon.png'), > > > ('/download$anything', '/recipes/default/download$anything'), > ('/panel/download$anything', '/recipes_panel/default/download$anything' > ), > > > ('/static$anything', '/recipes/static$anything'), > ('/panel/static$anything', '/recipes_panel/static$anything'), > > > ('/panel', '/recipes_panel/default/index'), > ('/panel$anything', '/recipes_panel$anything'), > ] > > routes_out = [(x, y) for (y, x) in routes_in] > > > > And then applications/traveler/routes.py > routes_in = [ > ('/', '/traveler/default/index'), > ('/robots.txt', '/traveler/static/robots.txt'), > ('/favicon.png', '/traveler/static/custom/favicon.png'), > > > ('/download$anything', '/traveler/default/download$anything'), > ('/panel/download$anything', '/traveler_panel/default/download$anything' > ), > > > ('/static$anything', '/traveler/static$anything'), > ('/panel/static$anything', '/traveler_panel/static$anything'), > > > ('/panel', '/traveler_panel/default/index'), > ('/panel$anything', '/traveler_panel$anything'), > ] > > routes_out = [(x, y) for (y, x) in routes_in] > > > *However, if go to traveler.com/ > <http://traveler.com/>recipes/default/index I can still access "recipes" > app, and I don't want that.* > Is it possible to restrict the access using pattern based routes? > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.