版权声明:本文为博主原创文章,未经博主允许不得转载。
lighttpd是一个轻量级的web服务器,后起之秀,虽然在静态文件比apache弱点,但是在动态服务方面要比apache强劲,现在基于lighttpd的应用越来越多,关于lighttpd的文档,可以在www.lighttpd.net看到,今天就说说它的rewrite_mod,rewrite_mode是url重写模块,这与url重定向是不一样的,下面是lighttpd官网上关于这个模块 说明:
mod_rewrite - rewriting
option | description |
---|---|
url.rewrite-once | rewrites a set of URLs internally and skip the rest |
url.rewrite-repeat | rewrites a set of URLs internally in the webserver, continue applying rewrite rules |
url.rewrite | same as url.rewrite-once |
url.rewrite-final | same as url.rewrite-once |
关于url.rewrite-once和url.rewrite-repeat的区别,官方文档就短短几句The difference between these options is that, while url.rewrite-repeat allows for applying multiple (seperately defined) rewrite rules in a row, url.rewrite-once will cause further rewrite rules to be skipped if the expression was matched.
没有例子,我试验了多次,才明白。
比如:
url.rewrite-one = {
"^/blog/csdn/aa/(.*)$" => "/csdn/blog/$1",
"^/blog/csdn/bb/(.*)$" => "/csdn/blog/$1",
"^/blog/csdn/cc/(.*)$" => "/csdn/blog/$1"
}
等价于:
url.rewrite-repeat= {
"^/blog/csdn/(aa|bb|cc)/(.*)$" => "/csdn/blog/$1"
}