Apache中加载了Https之后想要将http请求全部跳转为https要怎么做,网上找的一些做法都不行的样子

问答中心分类: LinuxApache中加载了Https之后想要将http请求全部跳转为https要怎么做,网上找的一些做法都不行的样子
Testview asked 6 年 ago
以下为apache中Vhost 80端口的配置
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot \”/data/wwwroot/domain.com\”
ServerName domain.com
ServerAlias domain.com
ErrorLog \”/data/wwwlogs/domain.com_error_apache.log\”
CustomLog \”/data/wwwlogs/domain.com_apache.log\” common
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://resource-pov.xxx.com/$1 [R=301,L]
</IfModule>
<Directory \”/data/wwwroot/domain.com\”>
#SetOutputFilter DEFLATE
Options Indexes FollowSymLinks ExecCGI
#Require all granted
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.html index.php
</Directory>
</VirtualHost>

1 Answers
oneinstack answered 6 年 ago
网站根目录放.htaccess 具体google,比如:https://blog.csdn.net/LMXQH/article/details/79265252