1============ 2URL Rewrites 3============ 4 5------------------- 6Module: 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 21Description 22=========== 23 24internal redirects, url rewrite 25 26Options 27======= 28 29url.rewrite-once 30 rewrites a set of URLs internally in the webserver BEFORE they are handled. 31 32 e.g. :: 33 34 url.rewrite-once = ( "<regex>" => "<relative-uri>" ) 35 36url.rewrite-repeat 37 rewrites a set of URLs internally in the webserver BEFORE they are handled 38 39 e.g. :: 40 41 url.rewrite-repeat = ( "<regex>" => "<relative-uri>" ) 42 43The options ``url.rewrite`` and ``url.rewrite-final`` were mapped to ``url.rewrite-once`` 44in 1.3.16. 45 46Warning 47======= 48 49Do NOT use mod_rewrite to protect specific urls, as the original url passed from the client 50is matched against your rules, for example strings like "/abc/../xyz%2f/path". 51 52Examples 53======== 54 55The regex is matching the full REQUEST_URI which is supplied by the user including 56query-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 78