Home  >  Article  >  Backend Development  >  How to hide .php in lighttpd

How to hide .php in lighttpd

藏色散人
藏色散人Original
2021-03-31 10:45:561865browse

lighttpd隐藏.php的方法:1、开启mod_rewrite模块;2、在“/etc/lighttpd/lighttpd.conf”中添加“url.rewrite-once=(...)”;3、进行全部配置即可。

How to hide .php in lighttpd

本文操作环境:Windows7系统、PHP7.1版,DELL G3电脑

lighttpd中隐藏php后缀方法

1.  开启mod_rewrite模块

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

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

3. 全部配置

$SERVER["socket"] == ":443" {
       
        protocol = "https://"
url.rewrite-once=(
"^/(.+)\?(.+)$" =>"/$1.php?$2"
)
       
        ssl.engine = "enable"
        ssl.pemfile = "/etc/lighttpd/newcert.pem"
        ssl.ca-file = "/etc/lighttpd/rootca.pem"
        ssl.verifyclient.activate="enable"
setenv.add-environment = (
                "HTTPS" => "on"
        )
     #server.name = "192.168.6.120"
server.document-root = "/var/www2/"
}

4. rewrite写规则参考

http://redmine.lighttpd.net/projects/1/wiki/Docs_ModRewrite

【推荐学习:PHP视频教程

The above is the detailed content of How to hide .php in lighttpd. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn