Tag Archives: rewrite

lighttpd支持rewrite的方法

官方文档写得很简单.它给的例子没那么简单了:
url.rewrite-once = ( "^/id/([0-9]+)$" => "/index.php?id=$1",
  "^/link/([a-zA-Z]+)" => "/index.php?link=$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://any.domain.com/url/
# before rewrite: REQUEST_URI="/www/htdocs/url/"
# and DOCUMENT_ROOT="/www/htdocs/" %0="any.domain.com" $1="url/"
# after rewrite: REQUEST_URI="/www/htdocs/any.domain.com/url/"
# still, you have DOCUMENT_ROOT=/www/htdocs/
server.document-root = "/www/htdocs/"
$HTTP["host"] =~ "^.*\.([^.]+\.com)$" {
  url.rewrite-once = ( "^/(.*)" => "/%0/$1" )
}
官方指出lighttpd与apache的rewrite的完全不同,它给的例子是:

Continue reading