redirect all subdomains from http to https using .htaccess

戏子无情 提交于 2019-12-31 07:28:07

问题


How do I redirect all subdomains of example.com from http to https using .htaccess?

I've searched Google and can't find a solution.


回答1:


To redirect all subdomains of example.com to https , you can use :

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^((?!www\.)[^.]+)\.example\.com$
RewriteRule ^ https://%1.example.com%{REQUEST_URI} [NE,L,R]


来源:https://stackoverflow.com/questions/38349915/redirect-all-subdomains-from-http-to-https-using-htaccess

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!