Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 我想将所有流量同时重定向到HTTPS和WWW_.htaccess - Fatal编程技术网

.htaccess 我想将所有流量同时重定向到HTTPS和WWW

.htaccess 我想将所有流量同时重定向到HTTPS和WWW,.htaccess,.htaccess,我现在拥有的是 RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L] 此代码仅重定向到HTTPS,而不从非Www重定向到Www # Canonical https/www <IfModule mod_rewrite.c> RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP

我现在拥有的是

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
此代码仅重定向到HTTPS,而不从非Www重定向到Www

# Canonical https/www
<IfModule mod_rewrite.c>
    RewriteCond %{HTTPS} off [OR]
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteCond %{HTTP_HOST} ^(.*)$  [NC]
    RewriteRule (.*) https://www.%1/$1 [R=301,L]
</IfModule>
#规范的https/www
重写cond%{HTTPS}关闭[或]
重写cond%{HTTP_HOST}^www\。[北卡罗来纳州]
重写条件%{HTTP_HOST}^(.*)$[NC]
重写规则(.*)https://www.%1/$1[R=301,L]
我以前试过这个代码

我开始得到像
https://www.www.example.com
这是一场灾难


是否有适当的代码同时执行HTTPS和WWW重定向?

我编辑了您的问题以便能够阅读…我编辑了您的问题以便能够阅读。。。