扫码关注官方订阅号
thinkphp 配置ssl 强制https访问时 如何去掉index.php后辍?
阿里云IIS7.5环境下 配置好了http 重写向https
可是输入http://www.xxx.com 后 会重定向到https://www.xxx.com/index.php/
如何去掉这个index.php???
index.php是thinkphp的入口文件
我的实现方法
不用配置iis url重写模块
直接在thinkphp 入口文件写入以下代码即可 (iis证书需要配置)
if ($_SERVER['HTTPS'] != "on") { $index = strstr($_SERVER['REQUEST_URI'],"index.php"); if($index){ $str = preg_replace('/\/index.php/', '', $_SERVER['REQUEST_URI']); $url = "https://" . $_SERVER["SERVER_NAME"] . $str; header("location:".$url); } }
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
index.php是thinkphp的入口文件
我的实现方法
不用配置iis url重写模块
直接在thinkphp 入口文件写入以下代码即可 (iis证书需要配置)