2017-02-27 17:03:12 3155次浏览 0条回答 0 悬赏 11 金钱

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;

所以,我现在应该怎么去设置这个重写规则?

补充于 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

补充于 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
    没有找到数据。
您需要登录后才可以回答。登录 | 立即注册
xczizz
副总裁

xczizz 比尔吉沃特

注册时间:2016-03-08
最后登录:2020-11-09
在线时长:97小时50分
  • 粉丝6
  • 金钱4967
  • 威望90
  • 积分6837

热门问题