当前位置: > Linux服务器 > Lighttpd >

lighttpd中隐藏php后缀方法

时间:2016-01-30 22:43来源:linux.it.net.cn 作者:IT


1.  开启mod_rewrite模块

2.  在/etc/lighttpd/lighttpd.conf中添加如下 代码




01.url.rewrite-once=( 
02.        "^/(.+)\?(.+)$" =>"/$1.php?$2", 
03.         "^/(.+)$" =>"/$1.php" 
04.    ) 


3. 全部配置



01.$SERVER["socket"] == ":443" { 
02.        
03.        protocol = "https://" 
04.    url.rewrite-once=( 
05.        "^/(.+)\?(.+)$" =>"/$1.php?$2" 
06.    ) 
07.        
08.        ssl.engine = "enable" 
09.        ssl.pemfile = "/etc/lighttpd/newcert.pem" 
10.        ssl.ca-file = "/etc/lighttpd/rootca.pem" 
11.        ssl.verifyclient.activate="enable" 
12.    setenv.add-environment = ( 
13.                "HTTPS" => "on" 
14.        ) 
15.        #server.name = "192.168.6.120" 
16.    server.document-root = "/var/www2/" 
17. 
18.} 


4. rewrite写规则参考

http://redmine.lighttpd.net/projects/1/wiki/Docs_ModRewrite
(责任编辑:IT)
------分隔线----------------------------