.htaccess强制重定向www以及https
今天遇见了一个问题,垃圾百度上什么都系都没找到,最后在stackoverflow上找到了解决方法。
https://stackoverflow.com/questions/12050590/redirect-non-www-to-www-in-htaccess
# Redirect to www RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$ RewriteCond %{HTTPS}s ^on(s)| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # Redirect to https RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]