配置apache默認使用ssl的方法_Web服務器教程
首先確認mod_rewrite已經安裝,方法就是查看你的httpd.conf,搜索“LoadModule rewrite_module modules/mod_rewrite.so”,如果有,刪除前面的"#"。
然后在下面添加,具體位置似乎沒有大的關系,可以自行測試一下:
RewriteEngine On
RewriteRule /.* https://www.example.com/ [R]
替換URL為你需要的就好了?吹狡渌胤竭添加了其他的選項,我這里就采用了最基本的官方說明了。有興趣的可以自己在研究一下。
P: Apache的官方文檔有個小錯誤,它用了http而不是https,那不是沒用了么,呵呵。
參考:
http://httpd.apache.org/docs/1.3/misc/howto.html
http://www.cyberciti.biz/tips/howto-apache-force-https-secure-connections.html
http://www.linuxquestions.org/questions/fedora-35/configuring-automatic-redirects-from-port-80-to-port-443-with-bundled-apache-server-609598/
相關Web服務器教程:
- 相關鏈接:
- 教程說明:
Web服務器教程-配置apache默認使用ssl的方法。