couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "Rewriting_urls" by StephaneAlnet
Date Sun, 15 May 2011 21:00:59 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The "Rewriting_urls" page has been changed by StephaneAlnet.
The comment on this change is: Added link to blog post by Jan Lehnardt explaining how to combine
rewriting with virtual hosts..
http://wiki.apache.org/couchdb/Rewriting_urls?action=diff&rev1=10&rev2=11

--------------------------------------------------

- This is an overview of http rewrite handler
+ This is an overview of http rewrite handler.
+ 
+ [[http://blog.couchone.com/post/443028592/whats-new-in-apache-couchdb-0-11-part-one-nice-urls|This
post]] has examples and shows how to combine Rewriting with [[Virtual_Hosts|Virtual hosts]]
to generate nice URLs in CouchDB.
  
  == The HTTP Rewrite Handler ==
  
- The http rewrite handler. All rewriting is done from 
+ The http rewrite handler. All rewriting is done from
  /dbname/_design/ddocname/_rewrite by default.
  
  each rules should be in rewrites member of the design doc.
  Ex of a complete rule :
  {{{
  
- { 
+ {
-     .... 
+     ....
-     "rewrites": [ 
+     "rewrites": [
-     { 
+     {
-         "from": "", 
+         "from": "",
-         "to": "index.html", 
+         "to": "index.html",
-         "method": "GET", 
+         "method": "GET",
-         "query": {} 
+         "query": {}
-     } 
+     }
-     ] 
+     ]
- } 
+ }
  
  
  }}}
@@ -35, +37 @@

  "*". ex:
  /somepath/:var/*
  
- This path is converted in erlang list by splitting "/". Each var are 
+ This path is converted in erlang list by splitting "/". Each var are
  converted in atom. "*" is converted to '*' atom. The pattern matching is done
- by splitting "/" in request url in a list of token. A string pattern will 
+ by splitting "/" in request url in a list of token. A string pattern will
- match equal token. The star atom ('*' in single quotes) will match any number 
+ match equal token. The star atom ('*' in single quotes) will match any number
- of tokens, but may only be present as the last pathtern in a pathspec. If all 
+ of tokens, but may only be present as the last pathtern in a pathspec. If all
  tokens are matched and all pathterms are used, then the pathspec matches. It works
  like webmachine. Each identified token will be reused in to rule and in query
  
- The pattern matching is done by first matching the request method to a rule. by 
+ The pattern matching is done by first matching the request method to a rule. by
  default all methods match a rule. (method is equal to "*" by default). Then
- It will try to match the path to one rule. If no rule match, then a 404 error 
+ It will try to match the path to one rule. If no rule match, then a 404 error
  is displayed.
  
  Once a rule is found we rewrite the request url using the "to" and
- "query" members. The identified token are matched to the rule and 
+ "query" members. The identified token are matched to the rule and
  will replace var. if '*' is found in the rule it will contain the remaining
  part if it exists.
  

Mime
View raw message