Http到https重定向不工作的几个页面



下面的htaccess代码只能在主页上工作。当我在URL中输入my.example.com时,htaccess重定向到https://my.example.com但当我输入my.example.com/login时,它没有重定向到https://my.example.com/login

(我不想要www作为我的域名)

<IfModule mod_rewrite.c>
    RewriteEngine on
    Options +FollowSymlinks
    RewriteBase /
    RewriteRule    ^$ app/webroot/    [L]
    RewriteRule    (.*) app/webroot/$1    [L]
    RewriteCond %{HTTP_HOST} ^[^.]+.[^.]+$
    RewriteCond %{HTTPS}s ^on(s)|
    RewriteRule ^https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

</IfModule>

请让我知道我哪里做错了?由于

在内部重写之前保留重定向规则,并修复http->https错误:

RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,NE,R=301]
RewriteRule (.*) app/webroot/$1 [L]

最新更新