Hi there,

I am trying to create redirects using web2py from effectively the default 
index page (or just the route of the domain/package). Some keywords (such 
as 'about', stored in a list) wouldn't redirect. However, all not in that 
list would redirect.

The desired behaviour is:
https://startbean.com/about -> No redirect
https://startbean.com/myc -> https://startbean.com/company/myc

The default page that is shown at startbean.com is from the package 
'default' and is called 'index'. If the redirect was as in the below, it 
would be easy:

https://startbean.com/default/about -> No redirect
https://startbean.com/default/index/myc -> 
https://startbean.com/default/company/myc

because the myc is a URL argument. But when it is from the root, Web2Py 
tries to open a package called 'myc' and then finds no page (index or 
controller function) so errors.

What is the best way of handling this? I was trying with routes.py, but 
couldn't figure out a way to do this (am pretty sure it is not supported). 
I thought about a redirect for the token after / to a page called 
/default/redirect/<token> which would then decide about the redirect, but 
there's no way to stop the infinite loop. Another possible solution was a 
tweak to the nginx config so redirect when there is one token after the /, 
but again I think this causes a problem with the about.

Maybe there is a catch-all function for controllers that I haven't found? 
I've gone through the web2py book and found nothing - any ideas very 
welcome!

Thanks,

Sam

-- 
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.

Reply via email to