鍍金池/ 問答/PHP  Linux  HTML/ apache 如何配置成 用戶輸入www.xxx.com 自動(dòng)跳轉(zhuǎn)到https:

apache 如何配置成 用戶輸入www.xxx.com 自動(dòng)跳轉(zhuǎn)到https://www.xxx.com

  1. 需求 當(dāng)用戶地址欄輸入 www.lunghealthbiotech.com/ 或者 www.lunghealthbiotech.com/sign/login/

會(huì)自動(dòng)跳轉(zhuǎn)到 https://www.lunghealthbiotech... 或者 https://www.lunghealthbiotech...

  1. 服務(wù)器為 linux ubuntu phpstudy
  2. 現(xiàn)在https 以生效
回答
編輯回答
赱丅呿

上面說的都是apache配置,這里我提供另外一種思路
可以通過apache指定http訪問一個(gè)目錄下 index.html
然后 文件利用

<meta http-equiv="refresh" content="0; url=https://www.xxx.com/" />

即可跳轉(zhuǎn)

2017年5月17日 05:31
編輯回答
遺莣

在.htaccess文件中寫入如下配置

RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R]
2018年4月2日 07:46
編輯回答
別瞎鬧

我對(duì)apache不熟悉,但是如果沒記錯(cuò)的話,使用下面的 htaccess

RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)?$ https://%{SERVER_NAME}/$1 [L,R]
2018年2月22日 08:51
編輯回答
司令
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
2017年5月24日 10:48