lighttpd中的rewrite

lighttpd是一个轻量级的web服务器,后起之秀,虽然在静态文件比apache弱点,但是在动态服务方面要比apache强劲,现在基于lighttpd的应用越来越多,关于lighttpd的文档,可以在www.lighttpd.net看到,今天就说说它的rewrite_mod,rewrite_mode是url重写模块,这与url重定向是不一样的,下面是lighttpd官网上关于这个模块 说明:

 

mod_rewrite - rewriting

optiondescription
url.rewrite-oncerewrites a set of URLs internally and skip the rest
url.rewrite-repeatrewrites a set of URLs internally in the webserver, continue applying rewrite rules
url.rewritesame as url.rewrite-once
url.rewrite-finalsame 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"

}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值