couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Lehnardt <...@apache.org>
Subject Re: rewrite not working (am I a noob?)
Date Sat, 20 Nov 2010 14:13:29 GMT

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 <jan@apache.org> 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
>> 
>> 


Mime
View raw message