Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

regex matching in lighttpd configs (See related posts)

Match the host name and rewrite paths like /images to blah.com/images:

   1  
   2  $HTTP["host"] =~ "^.*\.([^.]+\.[^.:]+)(:|^)" {
   3    url.rewrite = ( "^/images/(.*)" => "/%1/images/$1",
   4                   "^/files/(.*)" => "/%1/files/$1",
   5   "^/$" => "index.html", "^([^.]+)$" => "$1.html")
   6  }


provided by Dreamer3 and annotated here so I can quit bugging him about it.

You need to create an account or log in to post comments to this site.


Click here to browse all 5545 code snippets

Related Posts