發表文章

目前顯示的是有「cent」標籤的文章

CentOS 7 內 apache 2.4.6 強制使用 https

圖片
1. 編輯 /etc/httpd/conf/httpd.conf,加入如下藍色選項 <VirtualHost *:80>     ServerName www.mylinux.com.tw     DocumentRoot /var/www/html     Redirect permanent / https://www.mylinux.com.tw </VirtualHost> 2. systemctl restart httpd # 重新啟動apache 或 利用 .htaccess,適合租借空間 RewriteEngine on RewriteCond ^80$ RewriteRule "^/?(.*)" "https://%{HTTP_HOST}/$1" [R=301] (圖一) 參考自: https://www.centos.org/forums/viewtopic.php?t=62079 https://wiki.apache.org/httpd/RedirectSSL#Using_virtual_hosts_.28using_redirect.29