Hi Jan, Thank you for this answer. Those virtual hosts make the rewrites really useful.
Kind regards, Hendrik Jan On 20 November 2010 15:13, Jan Lehnardt <[email protected]> wrote: > > On 20 Nov 2010, at 14:56, Hendrik Jan van Meerveld wrote: > > > Thank you Jan, > > > > Indeed the URL > > > http://localhost:5984/test/_design/main/*_rewrite/xx*/bones/en-bones-home< > http://localhost:5984/test/_design/main/_rewrite/xx/bones/en-bones-home> > > now rewrites to > > http://localhost:5984/test/_design/main/*_show*/bones/en-bones-home< > http://localhost:5984/test/_design/main/_show/bones/en-bones-home> > > > > > > But does this mean that the original URL always needs to have "_rewrite" > in > > it? > > That's not what I call an pretty URL. > > Check out > http://blog.couchone.com/post/443028592/whats-new-in-apache-couchdb-0-11-part-one-nice-urls > > Rewrites are only half the story :) > > Cheers > Jan > -- > > > > > > Kind regards, > > Hendrik Jan > > > > On 20 November 2010 13:10, Jan Lehnardt <[email protected]> wrote: > > > >> Hi Hendrik, > >> > >> the base URL for rewrites is always > >> > >> /database/_design/app/_rewrites > >> > >> so `from: /xx/*`, `to: /_show/*` will rewrite > >> > >> /database/_design/app/_rewrites/xx/foobarbaz > >> > >> to > >> > >> /database/_design/app/_show/foobarbaz > >> > >> I hope that helps. > >> > >> Cheers > >> Jan > >> -- > >> > >> > >> On 20 Nov 2010, at 11:39, Hendrik Jan van Meerveld wrote: > >> > >>> Hi All, > >>> > >>> I'm trying to get url-rewrite to work in couchdb. > >>> My webpage is located at: > >>> > >>> http://localhost:5984/test/_design/main/_show/bones/en-bones-contact > >>> > >>> I edited the "rewrites" field in the _design/main document (using > futon) > >> as > >>> follows: > >>> > >>> <code> > >>> [ > >>> { > >>> "from": "/xx/*", > >>> "to": "/_show/*" > >>> }, > >>> { > >>> "from": "/_show/xx/*", > >>> "to": "/_show/bones/*" > >>> } > >>> ] > >>> </code> > >>> > >>> After saving this rewrite rule I was expecting that when I go to > >>> http://localhost:5984/test/_design/main/*xx*/bones/en-bones-contact< > >> http://localhost:5984/test/_design/main/xx/bones/en-bones-contact> > >>> or to > >>> http://localhost:5984/test/_design/main/_show/*xx*/en-bones-contact< > >> http://localhost:5984/test/_design/main/_show/xx/en-bones-contact> > >>> or to > >>> http://localhost:5984/test/_design/main/*xx/xx*/en-bones-contact< > >> http://localhost:5984/test/_design/main/xx/xx/en-bones-contact> > >>> this would show me the same page as the original. > >>> > >>> But is doesn't. > >>> I get errors like > >>> > >>> "Document is missing attachment" > >>> > >>> and > >>> > >>> "missing function" > >>> > >>> > >>> Am I doing anything wrong? > >>> Should the field not be named "rewrites" but something like "_rewrite"? > >>> > >>> Kind regards, > >>> Hendrik Jan > >> > >> > >
