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 将非www域重定向到除https以外的www域_.htaccess_Http Redirect_Url Redirection - Fatal编程技术网

.htaccess 将非www域重定向到除https以外的www域

.htaccess 将非www域重定向到除https以外的www域,.htaccess,http-redirect,url-redirection,.htaccess,Http Redirect,Url Redirection,我有一个类似www.mydomain.com的域名 我想将所有非www请求重定向到www,https请求除外 我正在使用这个,它将所有请求重定向到www RewriteCond %{HTTP_HOST} !^www\.mydomain\.com RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 我想做的是,防止请求重定向,例如添加以下内容(在重写规则之前): Apache mod_rewrite文档可用。对我不起作用:/

我有一个类似www.mydomain.com的域名

我想将所有非www请求重定向到www,https请求除外

我正在使用这个,它将所有请求重定向到www

RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
我想做的是,防止请求重定向,例如添加以下内容(在重写规则之前):


Apache mod_rewrite文档可用。

对我不起作用:/是否有任何方法可以重定向,例如,重写所有域,除非“”出现在前面?您可以尝试
RewriteCond%{SERVER\u PORT}!443
RewriteCond %{HTTPS} off