鍦.htaccess鏂囦欢涓皢HTTP閲嶅畾鍚戝埌HTTPS鍙互閫氳繃澶氱鏂规硶瀹炵幇銆備互涓嬫槸涓浜涘父瑙佺殑鏂规硶锛

浣跨敤mod_rewrite妯″潡锛氬湪.htaccess鏂囦欢涓坊鍔犱互涓嬩唬鐮侊細

apache
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
杩欎細灏嗘墍鏈夐氳繃HTTP璁块棶鐨勮姹傞噸瀹氬悜鍒癏TTPS銆

浣跨敤Redirect鎸囦护锛氬湪.htaccess鏂囦欢涓坊鍔犱互涓嬩唬鐮侊細

apache
Redirect permanent / https://www.example.com/
杩欏皢鎶婃墍鏈変互HTTP鍗忚璁块棶鐨勮姹傛案涔呴噸瀹氬悜鍒癏TTPS銆

浣跨敤SSL/TLS閲嶅畾鍚戯細鍦.htaccess鏂囦欢涓坊鍔犱互涓嬩唬鐮侊細

apache
Header always set Content-Security-Policy "upgrade-insecure-requests"
杩欎細灏嗘墍鏈夋湭浣跨敤HTTPS鐨勮姹傞噸瀹氬悜鍒癏TTPS銆傝娉ㄦ剰锛岃繖绉嶆柟娉曢渶瑕佹湇鍔″櫒鏀寔CSP锛堝唴瀹瑰畨鍏ㄧ瓥鐣ワ級銆

鏃犺鎮ㄩ夋嫨鍝鏂规硶锛岄兘搴旂‘淇濆湪灏咹TTP閲嶅畾鍚戝埌HTTPS鏃朵娇鐢ㄦ案涔呴噸瀹氬悜锛301锛夛紝浠ヤ究姝g‘鍦颁紶閫扴EO鍊笺

浠ヤ笂灏辨槸.hatacess 鏂囦欢 http閲嶅畾鍚戝埌https鐨勮缁嗗唴瀹癸紝鏇村淇℃伅璇峰叧娉∣D浜戝叾瀹冪浉鍏虫枃绔狅紒



鏈枃URL锛http://www.odweb.cn/news_show.html?id=229