Some of the information here may be outdated, please check the book instead
[edit]

Yes. web2py has something that works like rails routes and a syntax very similar to Django urls. Plus we allow URL rewrite filtering based on the client IP address.

example: create a file called routes.py in web2py/ and write in it something like:

routes_in=(
   ('^140\.192\.34\.157:.*','/examples/default/index'), # this guy can only access the index page
   ('^.*:.*\.php','/examples/default/index'), # maps all .php pages into index page (no php here!)
   ('^.*:/docs/(?P<key>)','/examples/\g<key>'), # maps /docs into /examples for everybody
)

routes_out=(
   ('^/examples/default/index$','/examples'), # makes shorter URL for /examples/default/index
)

Mind that editing routes can break some links in your app. This page will be expended soon.

© 2008-2010 by Massimo Di Pierro - All rights reserved - Powered by web2py - design derived from a theme by the earlybird
The content of this book is released under the Artistic License 2.0 - Modified content cannot be reproduced.