服务器之家:专注于服务器技术及软件下载分享
分类导航

云服务器|WEB服务器|FTP服务器|邮件服务器|虚拟主机|服务器安全|DNS服务器|服务器知识|Nginx|IIS|Tomcat|

服务器之家 - 服务器技术 - 服务器知识 - 配置apache默认使用ssl的方法

配置apache默认使用ssl的方法

2021-08-27 17:55服务器知识网 服务器知识

首先确认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/

延伸 · 阅读

精彩推荐