From 396a4de69b49ceca35a3f132227d5c652732ba58 Mon Sep 17 00:00:00 2001 From: mOo Date: Thu, 20 Oct 2005 03:27:03 +0000 Subject: [PATCH] more document git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@793 152afb58-edef-0310-8abb-c4023f1b3aa9 --- doc/redirect.txt | 2 ++ doc/rewrite.txt | 25 ++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/doc/redirect.txt b/doc/redirect.txt index eea05d29..118ea8eb 100644 --- a/doc/redirect.txt +++ b/doc/redirect.txt @@ -34,6 +34,8 @@ url.redirect url.redirect = ( "^/show/([0-9]+)/([0-9]+)$" => "http://www.example.org/show.php?isdn=$1&page$2", "^/get/([0-9]+)/([0-9]+)$" => "http://www.example.org/get.php?isdn=$1&page$2" ) + # make a external redirect + # from any www.host (with www.) to the host (without www.) $HTTP["host"] =~ "^www\.(.*)" { url.redirect = ( "^/(.*)" => "http://%1/$1" ) } diff --git a/doc/rewrite.txt b/doc/rewrite.txt index d5277ff4..aed31c61 100644 --- a/doc/rewrite.txt +++ b/doc/rewrite.txt @@ -52,6 +52,29 @@ query-string.:: url.rewrite-once = ( "^/id/([0-9]+)$" => "/index.php?id=$1", "^/link/([a-zA-Z]+)" => "/index.php?link=$1" ) - $HTTP["host"] =~ "^([^.]+)\.(this-is-mass-vhost\.com)" { + + # request: http://www.domain.com/url/ + # or request: http://any.domain.com/url/ + # before write: /www/htdocs/url/ + # after rewrite: /www/htdocs/domain.com/url/ + # document-root=/www/htdocs/ %0=www.domain.com $1=url/ + server.document-root = "/www/htdocs/" + $HTTP["host"] =~ "^.*\.([^.]+\.com)$" { + url.rewrite-once = ( "^/(.*)" => "/%0/$1" ) + } + + + # request: http://abc.mass-serve-subdomain.com/url/ + # before rewrite: /www/htdocs/url/ + # after rewrite: /www/htdocs/mass-serve-subdomain.com/abc/url/ + $HTTP["host"] =~ "^([^.]+)\.mass-subdomain\.com" { + server.document-root = "/www/htdocs/mass-subdomain.com" + url.rewrite-once = ( "^/(.*)" => "/%1/$1" ) + } + + + # similar effect as above, except that you have multiply mass-subdomain now + server.document-root = "/www/htdocs/" + $HTTP["host"] =~ "^([^.]+)\.(mass-subdomain\.com|mass-subdomain\.net)" { url.rewrite-once = ( "^/(.*)" => "/%2/%1/$1" ) }