相关链接:
Apache支持Vue router使用 HTML5History 模式
在修改以下配置之前,请先阅读以上文章,开启相应模块支持
方法一、修改httpd.conf
<VirtualHost *:80>
ServerName www.xxx.com
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/?(.*)$ https://%{SERVER_NAME}/$1 [L,R]
</VirtualHost>
方法二、修改.htaccess
在.htaccess文件中添加以下代码
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.xxx.com/$1 [L,R=301]
注:www.xxx.com为你的域名