做完上一篇的SSL憑證後,網頁都順利的加上綠鎖頭 But卻發現一個小bug
在輸入網址時直接輸入smilehsu.cc或 www.smilehsu.cc 沒有加http:// 或 https:// 網址會自動轉到 Apache的起始畫面

解決方法 修改網站的http.conf設定檔 nano /etc/httpd/conf.d/ssl.conf
ServerAdmin [email protected] DocumentRoot /var/www/html/wordpress ServerName smilehsu.cc RewriteEngine on RewriteRule ^(.*) http://test.smilehsu.cc$1 [R=301,L]
備註:
資料引用來源: 1.[apache] 轉址 2.【FreeBSD】在 Apache 利用 mod_rewrite 做到網址轉換 3.[Rewrite note.] 重寫規則筆記 4.[Apache] 自訂轉址:利用 .htaccess 做網址重寫 (URL rewrite) 5.[Apache] 設定特定網頁轉址到HTTPS,其他網頁均轉向HTTP 6.如何將網址從http轉為https ?!