diff --git a/doc/rewrite.txt b/doc/rewrite.txt index aed31c61..09d4b661 100644 --- a/doc/rewrite.txt +++ b/doc/rewrite.txt @@ -53,28 +53,19 @@ query-string.:: "^/link/([a-zA-Z]+)" => "/index.php?link=$1" ) - # 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" ) - } + # the following example, is, however just simulating vhost by rewrite + # * you can never change document-root by mod_rewrite + # use mod_*host instead to make real mass-vhost - # 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" ) - } + # request: http://any.domain.com/url/ + # before rewrite: REQUEST_URI="/www/htdocs/url/" + # and DOCUMENT_ROOT="/www/htdocs/" %0="www.domain.com" $1="url/" + # after rewrite: REQUEST_URI="/www/htdocs/domain.com/url/" + # still, you have DOCUMENT_ROOT=/www/htdocs/ - - # 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" ) + $HTTP["host"] =~ "^.*\.([^.]+\.com)$" { + url.rewrite-once = ( "^/(.*)" => "/%0/$1" ) } +