.htaccess文件重定向到子域,但保持https重定向

时间:2019-07-15 15:47:55

标签: .htaccess web-hosting

我在虚拟主机上有几个文件夹,我想像这样使用它们: foldername.mydomain.com

到目前为止,它一直运行良好,但是最近我替换了.htaccess文件,因为我还想将http查询重定向到https。

现在https重定向有效,但是每当我输入foldername.mydomain.com时,它都会将我重定向到https://www.foldername.mydomain.com/foldername

我应该如何修改才能使两者都起作用?


    RewriteEngine On
    RewriteCond %{HTTPS} !on
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

0 个答案:

没有答案
相关问题