虽说是面向百度编程 但是自己的情况和别人的还是有点不同 踩了很多坑 也花了不少时间 现在记录一下
在已配置好https的情况下
在/etc/apache2/apache2.conf
添加以下代码
<VirtualHost *:80>
ServerName 你的网址
ServerAlias 你的网址
RewriteEngine on
RewriteRule ^(.*)?$ https://你的网址$1 [R=301,L]
</VirtualHost>
重启apache2service apache2 restart