我需要实现SSL重定向。 HTTP / https和非www网址应强制重定向到https://www网址。
htaccess文件中存在浏览器身份验证代码,这就是重定向到https://exmpledomain/.shtml的原因
答案 0 :(得分:0)
After the Authentication code please write this
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ ([^\ ]+)
RewriteRule ^ https://www.%{HTTP_HOST}%2 [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ ([^\ ]+)
RewriteRule ^ https://%{HTTP_HOST}%2 [L,R=301]