The rule you want is
routes_in = [
('/$anything',
'/appname/view/user/<http://www.domain.com/appname/view/user/user_first_name>
$anything')
]
but before this rule you must make sure treat other URLs as exceptions
(should not be mapped):
routes_in = [
('/admin','/admin'),
('/admin/$anything','/admin/$anything'),
('/appname','/appname/default/index'),
('/appname/$anything','/appname/$anything'),
('/$anything',
'/appname/view/user/<http://www.domain.com/appname/view/user/user_first_name>
$anything')
]
routes_out = [(b,a) for (a,b) in routes_in]
You may need more rules for other apps. username equal to appnames will not
be allowed.
On Saturday, July 7, 2012 4:51:36 PM UTC-5, Sushant Taneja wrote:
>
> Hi,
>
> I want to generate vanity urls for my users. For example:
> www.domain.com/user_first_name
> The above URL should actually point to the
> www.domain.com/appname/view/user/user_first_name
>
> How should I configure my routes.py so that I can achieve the above
> without disturbing other URLs ?
> Also I would like to remove the application name from all the URLs.
>
> I read about routes.py from the web2py online book. But was unable to form
> routes_in and routes_out correctly.
>
> PS: My application is deployed on AppEngine
>
> Thanks,
> Sushant
>
>