怎么把不带www的https跳转到带www的https
例如访问https://baidu.com/http://baidu.com/http://www.baidu.com都是统一跳转到https://www.baidu.com
我的环境是apache
用 .htaccess
RewriteEngine on RewriteCond %{SERVER_PORT} !^443$ RewriteCond %{REQUEST_URI} !^/tz.php RewriteRule (.*) https://%{SERVER_NAME}/$1 [R]
还是建议用NGINX
或者php跳转
if $_SERVER["HTTPS"] != "on"
header( "Location: https://" . $_SERVER["HTTP_HOST"] );
热门标签: