iT邦幫忙

0

htaccess redirect 問題!

第一個問題
假設有個域名是
http://xxx.ooo.com/
但我這是有 https的,但是他卻不會自己加
假設有人進入 http://xxx.ooo.com/ 時,是否可以增加 https://xxx.ooo.com/ 並重定向?

第二個問題
假設進入https://ppp.com ,但這其實沒有https,所以他會警告然後停住,怎樣實現假設進入 https://ppp.com,可以轉移到 https://www.ppp.com

黃彥儒 iT邦高手 1 級 ‧ 2018-06-10 23:22:07 檢舉
第二個問題:不可能,沒SSL在交握階段就打住了,不會理你的
黃彥儒 iT邦高手 1 級 ‧ 2018-06-10 23:22:27 檢舉
第一個問題網路很多,自己Google下
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

1
nicelink001
iT邦新手 4 級 ‧ 2018-06-11 09:12:08
最佳解答

我習慣用 Rewrite

apache :

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]

nginx :

server {
listen 80 default_server;
listen [::]:80 default_server;
server_name example.com www.example.com;
return 301 https://$server_name$request_uri;
}

https://ppp.com 轉移到 https://www.ppp.com
也用 rewrite 處理 .......

我要發表回答

立即登入回答