Annotation of embedaddon/lighttpd/doc/outdated/rewrite.txt, revision 1.1.1.1

1.1       misho       1: ============
                      2: URL Rewrites
                      3: ============
                      4: 
                      5: -------------------
                      6: Module: mod_rewrite
                      7: -------------------
                      8: 
                      9: :Author: Jan Kneschke
                     10: :Date: $Date: 2004/11/03 22:26:05 $
                     11: :Revision: $Revision: 1.2 $
                     12: 
                     13: :abstract:
                     14:   url rewrite
                     15: 
                     16: .. meta::
                     17:   :keywords: lighttpd, rewrite
                     18: 
                     19: .. contents:: Table of Contents
                     20: 
                     21: Description
                     22: ===========
                     23: 
                     24: internal redirects, url rewrite
                     25: 
                     26: Options
                     27: =======
                     28: 
                     29: url.rewrite-once
                     30:   rewrites a set of URLs interally in the webserver BEFORE they are handled.
                     31: 
                     32:   e.g. ::
                     33: 
                     34:     url.rewrite-once = ( "<regex>" => "<relative-uri>" )
                     35: 
                     36: url.rewrite-repeat
                     37:   rewrites a set of URLs interally in the webserver BEFORE they are handled
                     38: 
                     39:   e.g. ::
                     40: 
                     41:     url.rewrite-repeat = ( "<regex>" => "<relative-uri>" )
                     42: 
                     43: The options ``url.rewrite`` and ``url.rewrite-final`` were mapped to ``url.rewrite-once``
                     44: in 1.3.16.
                     45: 
                     46: Warning
                     47: =======
                     48: 
                     49: Do NOT use mod_rewrite to protect specific urls, as the original url passed from the client
                     50: is matched against your rules, for example strings like "/abc/../xyz%2f/path".
                     51: 
                     52: Examples
                     53: ========
                     54: 
                     55: The regex is matching the full REQUEST_URI which is supplied by the user including
                     56: query-string.::
                     57: 
                     58:   url.rewrite-once = ( "^/id/([0-9]+)$" => "/index.php?id=$1",
                     59:                        "^/link/([a-zA-Z]+)" => "/index.php?link=$1" )
                     60: 
                     61: 
                     62: 
                     63:   # the following example, is, however just simulating vhost by rewrite
                     64:   # * you can never change document-root by mod_rewrite
                     65:   # use mod_*host instead to make real mass-vhost
                     66: 
                     67:   # request:        http://any.domain.com/url/
                     68:   # before rewrite: REQUEST_URI="/www/htdocs/url/"
                     69:   # and DOCUMENT_ROOT="/www/htdocs/" %0="www.domain.com" $1="url/"
                     70:   # after rewrite:  REQUEST_URI="/www/htdocs/domain.com/url/"
                     71:   # still, you have DOCUMENT_ROOT=/www/htdocs/
                     72: 
                     73:   server.document-root = "/www/htdocs/"
                     74:   $HTTP["host"] =~ "^.*\.([^.]+\.com)$" {
                     75:     url.rewrite-once = ( "^/(.*)" => "/%0/$1" )
                     76:   }
                     77: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>