>
> Is it possible to have wildcard URL mappings without specifying the 
> controller in the url? 
> Say for instance if I want to have, "myurl.com/random1" and "
> myurl.com/r4nd0m2" to be forwarded to a single controller to perform an 
> action within that controller, how can that be done with web2py, without 
> permitting that controller to be called directly by 
> myurl.com/controllername? (basically, instead of 
> myurl.com/controllername/random1 -> myurl.com/random1)
>

Yes, I suggest you look at 
http://web2py.com/books/default/chapter/29/4#URL-rewrite as well as the 
/web2py/routes.example.py and /web2py/router.example.py files. The 
paramater-based rewrite system works well for common simple cases, like 
removing the app name and default controller name (and a default function 
name per controller) from all URLs. For more complex cases, the 
pattern-based rewrite system is quite flexible.

The nice thing about the rewrite systems is that they work in reverse as 
well -- if you use the URL() function to generate URLs, they will 
automatically be rewritten according to the rewrite rules.

Anthony 

Reply via email to