diff --git a/doc/lighttpd.conf b/doc/lighttpd.conf index bebf846d..86fc93ec 100644 --- a/doc/lighttpd.conf +++ b/doc/lighttpd.conf @@ -254,6 +254,10 @@ static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) #### url handling modules (rewrite, redirect, access) #url.rewrite = ( "^/$" => "/server-status" ) #url.redirect = ( "^/wishlist/(.+)" => "http://www.123.org/$1" ) +#### both rewrite/redirect support back reference to regex conditional using %n +#$HTTP["host"] =~ "^www\.(.*)" { +# url.redirect = ( "^/(.*)" => "http://%1/$1" ) +#} # # define a pattern for the host url finding diff --git a/doc/redirect.txt b/doc/redirect.txt index 10c6a16a..eea05d29 100644 --- a/doc/redirect.txt +++ b/doc/redirect.txt @@ -34,3 +34,6 @@ 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" ) + $HTTP["host"] =~ "^www\.(.*)" { + url.redirect = ( "^/(.*)" => "http://%1/$1" ) + } diff --git a/doc/rewrite.txt b/doc/rewrite.txt index b5854948..d5277ff4 100644 --- a/doc/rewrite.txt +++ b/doc/rewrite.txt @@ -51,3 +51,7 @@ 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)" { + url.rewrite-once = ( "^/(.*)" => "/%2/%1/$1" ) + }