Finally i got it right.
Its so cool, ive corrected something that happens when you are logged in,
if you visit /myapp/default/user it takes you to the login page, i was able
to redirect to the profile page.
If the url ends with numbers it converts them into args regardless the url
you are in.
static files doesnt have to be preceeded by the app name.. and so on.
default_application = 'myapp' # ordinarily set in base routes.py
default_controller = 'default' # ordinarily set in app-specific routes.py
# default_function = 'index' # ordinarily set in app-specific routes.py
BASE = '' # optonal prefix for incoming URLs
routes_in = (
# do not reroute admin unless you want to disable it
(BASE + '/admin', '/admin/default/index')
, (BASE + '/admin/$anything', '/admin/$anything')
# do not reroute appadmin unless you want to disable it
, (BASE + '/$app/appadmin', '/$app/appadmin/index')
, (BASE + '/$app/appadmin/$anything', '/$app/appadmin/$anything')
# do not reroute static files
, (BASE + '/static/$anything', '/%s/static/$anything' %
default_application)
# , (BASE + '/$app/static/$anything', '/$app/static/$anything')
# reroute favicon and robots, use exable for lack of better choice
, ('/favicon.ico', '/examples/static/favicon.ico')
, ('/robots.txt', '/examples/static/robots.txt')
# do not reroute user login
# default controller
, ('/', '/%s/default/index' % default_application)
, ('/(\d+)/?', r'/%s/default/index/\1' % default_application)
, ('/(\d+)/$anything', r'/%s/default/index/\1/$anything' %
default_application)
, ('/user/?', '/%s/default/user/profile' % default_application)
, ('/user/$anything', '/%s/default/user/$anything' % default_application
)
# other controllers
, ('/$c/?', '/%s/$c/index' % default_application)
, ('/$c/(\d+)/?', r'/%s/$c/index/\2' % default_application)
, ('/$c/(\d+)/$anything', r'/%s/$c/index/\2/$anything' %
default_application)
, ('/$c/$anything', '/%s/$c/$anything' % default_application)
# remove the BASE prefix
, (BASE + '/$anything', '/$anything')
)
routes_out = (
# do not reroute admin unless you want to disable it
('/admin/$anything', BASE + '/admin/$anything')
# do not reroute appadmin unless you want to disable it
, ('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything')
# do not reroute static files
# , ('/$app/static/$anything', BASE + '/$app/static/$anything')
, ('/%s/static/$anything' % default_application, BASE +
'/static/$anything')
# default controller
, ('/%s/default/user/$anything' % default_application, '/user/$anything'
)
, ('/%s/default/index' % default_application, '/')
# other controllers
# restore the BASE prefix
, ('/$anything', BASE + '/$anything')
)
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.