lighttpd隐藏.php的方法:1、开启mod_rewrite模块;2、在“/etc/lighttpd/lighttpd.conf”中添加“url.rewrite-once=(...)”;3、进行全部配置即可。
本文操作环境:Windows7系统、PHP7.1版,DELL G3电脑
lighttpd中隐藏php后缀方法
1. 开启mod_rewrite模块
2. 在/etc/lighttpd/lighttpd.conf中添加如下 代码
立即学习“PHP免费学习笔记(深入)”;
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视频教程】
以上就是lighttpd怎么隐藏.php的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号