簡體   English   中英

Http到https重定向不適用於幾個頁面

[英]Http to https redirect not working for few pages

以下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]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM