close
做完上一篇的SSL憑證後,網頁都順利的加上綠鎖頭
But卻發現一個小bug

在輸入網址時直接輸入smilehsu.cc或 www.smilehsu.cc
沒有加http:// 或 https://
網址會自動轉到 Apache的起始畫面


解決方法
修改網站的http.conf設定檔
nano /etc/httpd/conf.d/ssl.conf
<VirtualHost *:80>
ServerAdmin webmaster@smilehsu.cc
DocumentRoot /var/www/html/wordpress
ServerName smilehsu.cc
RewriteEngine on
RewriteRule ^(.*) https://smilehsu.cc$1 [R=301,L]
</VirtualHost>





備註:

資料引用來源:
1.[apache] 轉址
2.【FreeBSD】在 Apache 利用 mod_rewrite 做到網址轉換
3.[Rewrite note.] 重寫規則筆記
4.[Apache] 自訂轉址:利用 .htaccess 做網址重寫 (URL rewrite)
5.[Apache] 設定特定網頁轉址到HTTPS,其他網頁均轉向HTTP
6.如何將網址從http轉為https ?!
arrow
arrow
    全站熱搜

    正義的胖虎 發表在 痞客邦 留言(0) 人氣()