标题:
Apache环境强制跳转到https
[打印本页]
作者:
xiexie
时间:
2022-11-10 10:20
标题:
Apache环境强制跳转到https
网站申请完证书后,配置https,如果不想http访问,需要强制跳转http的访问到https,具体代码如下:<VirtualHost *:80>
<Directory "D:/web/xxx">
Options FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
ServerAdmin
877040117@qq.com
DocumentRoot "D:/web/xxx"
ServerName
www.xxx.com
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{SERVER_NAME}$1 [L,R]
ErrorLog "logs/xxx-error.log"
CustomLog "logs/xxx-access.log" common
</VirtualHost>
测试通过。
欢迎光临 PHP开发笔记 (http://phpvi.com/)
Powered by Discuz! 6.1.0