Jonathan Lundell my default controler is default.py which has the funktion viewArticle by using the router I said that default.py is the default controler so this is no longer in the URL.
On Thursday, March 14, 2013 6:58:01 PM UTC+1, Jonathan Lundell wrote: > > On 14 Mar 2013, at 10:45 AM, BlueShadow <[email protected] <javascript:>> > wrote: > > I was wondering if it is possible to change the dynamic URLs to static > ones. eg www.mydomain.com/Controler/Function?id=34 to > www.mydomain.com/titleofpage > So far I removed the controler by setting it in the routes.py as default > controler. > I know that you could do it manually by using the .htaccess file with mod > rewrite. > In my sample domain lets say the functions name would be viewArticle and > the parameter id=xx the id number of the article. lets say the title of the > article is "web2py - An awesome framework" > I would love to have this URL > www.mydomain.com/viewArticle_web2py_An_awesome_framework > any ideas other than mine to write to the htaccess file every time a new > article is written? Well I know one could do it by python code. > > > > The parametric router will give you a URL like: > > www.mydomain.com/viewArticle/web2py_An_awesome_framework > > ...and if you list the functions in viewArticle and make it the default > controller, you can use: > > www.mydomain.com/web2py_An_awesome_framework > > Of course, viewArticle needs to know how to look up an article by its slug > (which it will find in request.args(0)) > > > FWIW, if you only (or mostly) view articles, I'd choose a name more like: > > www.mydomain.com/view/web2py_An_awesome_framework > > -- --- 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

