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

For example, you have installed web2py in mydomain.com root web folder, and written your application called "myapp". By default you can access your application through mydomain.com/myapp/default/index. However, sometimes, it is needed to have it in the way, like mydomain.com/default/index, and all other installed applications (f.e. admin) should be still accessible in just normal way as mydomain.com/admin/default/index.

This task can be easily solved with help of mod_rewrite. Just check if your provider support it (normally it is the case). And put the next file in your root web folder.

RewriteEngine On
RewriteBase /

RewriteCond   %{REQUEST_URI}    !^/myapp
RewriteCond   %{REQUEST_URI}    !^/admin
RewriteCond   %{REQUEST_URI}    !^/some_other_exception
RewriteRule   ^(.*)             /myapp/$1  [L]

and save this file as ".htaccess"

With this file, every URL that does not start with /admin/ or /some_other_exception/ will be routed to /myapp/. For example, if user calls mydomain.com/some_cool_stuff/index it will be redirected to mydomain/myapp/some_cool_stuff/index. The redirection will be done internally, so user doesn't see "my_app" in navigation panel of browser.

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