在 Apache2 中将 http 重定向到 https,我的域构建是在 var/www/html 中



我已经在var/www/html中上传了build,并且ssl正在配置并尝试将http重定向到https,但它没有重定向。我已经检查了.htaccess文件,但它不起作用。

在 htaccess 中包含此内容以将 http 重定向到 https

RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

在 htaccess 中包含此内容以将 www 重定向到非 www

RewriteCond %{HTTP_HOST} www.yourdomain.com
RewriteRule (.*) https://yourdomain.com/$1 [R=301,L]

相关内容

最新更新