伪静态如何配置既可以去掉index.php 又可以使用 https [ 未指定版本 ]
RewriteRule ^(.*)$ https://%{SERVER_NAME}/index.php%{REQUEST_URI} [L,R=301]
这么写之后,首页可以访问:https://test.yii.com
;
但是其他的就404了:https://test.yii.com/site/create
;
手动改地址添加index.php 也可以访问:https://test.yii.com/index.php/site/create
;
所以,我现在应该怎么去设置这个重写规则?
xczizz 补充于 2017-02-27 17:36
貌似解决了???
在重写规则中添加两行在最上方:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
//其他规则
现在这么写没有什么毛病;
参考链接:https://www.sslshopper.com/apache-redirect-http-to-https.html
xczizz 补充于 2017-02-27 17:41
现在我的完整规则:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
共 0 个回答
没有找到数据。
xczizz 比尔吉沃特
注册时间:2016-03-08
最后登录:2020-11-09
在线时长:97小时50分
最后登录:2020-11-09
在线时长:97小时50分
- 粉丝6
- 金钱4967
- 威望90
- 积分6837