0

Ok so now I've added a rewrites.js file to my Couchapp root folder. In this js file I have...

[
   {
       "method": "GET",
       "from": "/home",
       "to": "app/index.html",
   }
]

Now when I push the Couchapp, in CouchDB in my _design/rednecks I see it's creating a "rewrites" property with the above js. So this looks all good to me. This is how to do this right?

I changed my local.ini vhost to...

[vhosts]
rnr.couchdb:5984 = /rednecks/_design/rednecks

In Chrome I enter url...

http://rnr.couchdb:5984/home

I get same error...

{"error":"not_found","reason":"Document is missing attachment"}

That app/index.html attachment is absolutely there. I can see it. The app runs fine if I disable rewrites and use the ugly urls. I've tried every variation of the "to" string that I can think of and all I see is that same error above.

Does anyone know how to do this?!?!?!....

Followup...

Ok following Marek's advice and setting my rewrites.json file to this...

[
    { "from": "home", "to": "app/index.html" },
    { "from": "lib/*", "to": "app/lib/*" },
    { "from": "js/*", "to": "app/js/*" },
    { "from": "css/*", "to": "app/css/*" },
    { "from": "img/*", "to": "app/img/*" }
]

It's almost there. It's starting to come together now thanks to your help :-)

Zach Smith
  • 8,458
  • 13
  • 59
  • 133
Locohost
  • 1,682
  • 5
  • 25
  • 38

1 Answers1

1

I believe you configured your vhost wrong. It should be:

[vhosts]
rnr.couchdb:5984 = /rednecks/_design/rednecks/_rewrite
Marek Kowalski
  • 1,782
  • 9
  • 11
  • I have the rewrites.json in the Couchapp root. When I push the project to CouchDB, a "rewrites" property is created in the _design/rednecks doc. This property has the content of the rewrites.json file. But your vhosts example above appears to be pointing to some other doc with _id = _design/redecks/_rewrite. What is this other doc for and what is it's content? Couchapp push process doesn't appear to use it, but I could be wrong. Thanks a lot for your help! I need it :-) – Locohost Oct 10 '13 at 14:24