Home > Backend Development > PHP Problem > How to hide .php in lighttpd

How to hide .php in lighttpd

藏色散人
Release: 2023-03-09 09:00:01
Original
1949 people have browsed it

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"
)
Copy after login

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/"
}
Copy after login

4. rewrite写规则参考

http://redmine.lighttpd.net/projects/1/wiki/Docs_ModRewrite
Copy after login

【推荐学习: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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template