[英]www.example.com not redirecting to HTTPS
When we enter example.com
in browser address bar it will redirecting to https://example.com
and also inner pages working (redirecting to https
site), 当我们在浏览器地址栏中输入
example.com
时,它将重定向到https://example.com
,并且内部页面也有效(重定向到https
站点),
When we enter www.example.com
in browser address bar it is not redirecting to https://www.example.com
and Site loading without https
, but inner pages are redirecting to https
当我们在浏览器地址栏中输入
www.example.com
,它不会重定向到https://www.example.com
和不带https
网站加载,但是内部页面会重定向到https
https://example.com/file.php
shows current content, but http://www.example.com/file.php
shows old content, We checked in Incognito mode and clearing the caches https://example.com/file.php
显示当前内容,而http://www.example.com/file.php
显示旧内容,我们在隐身模式下检查并清除了缓存
When we are seeing the $_SERVER
parameters by accessing the url http://www.example.com/server.php
shows HTTPS
value as on
当我们看到
$_SERVER
通过访问URL参数http://www.example.com/server.php
显示HTTPS
的值on
We print_r
the $_SERVER
in server.php
file 我们在
server.php
文件中print_r
$_SERVER
mod_rewrite
enabled) mod_rewrite
) we placed https
address for both Site url
and Home page url
as https://example.com
我们将
Site url
和Home page url
https
地址都设置为https://example.com
.htaccess
for redirection .htaccess
的以下代码进行重定向 RewriteCond %{HTTPS} !on [OR]
RewriteCond %{HTTP_HOST} ^www\.example.com$
RewriteRule ^(.*)$ https://example.com%{REQUEST_URI} [L,R=301]
SSL
SSL
表示肯定的答复 https://www.sslshopper.com
, whynopadlock.com
https://www.sslshopper.com
: whynopadlock.com
A (Host) 一个举办方)
@
Points To xx.xx.xx.xx
with TTL 600 Seconds
@
以TTL 600 Seconds
xx.xx.xx.xx
CName (Alias) CName(别名)
www
Points To @
with TTL 1 Hour
www
指向TTL为1 Hour
@
Please suggest how can i resolve this issue with www.example.com
to https
请建议我如何使用
www.example.com
将问题解决为https
RewriteCond %{HTTP_HOST} ^www.%{HTTP_HOST} is an invaild condition and it never returns true because you can not use server variable in RewriteCond's pattern. RewriteCond%{HTTP_HOST} ^ www。%{HTTP_HOST}是一个无效条件,它永远不会返回true,因为您不能在RewriteCond的模式中使用服务器变量。 You can use Regex based pattern like the following :
您可以使用基于Regex的模式,如下所示:
RewriteCond %{HTTP_HOST} ^www\.example.com$
I am using below code in .htaccess file to redirect http request to https. 我正在使用.htaccess文件中的以下代码将http请求重定向到https。
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP_USER_AGENT} !MSIE/[1-8]\. [NC]
RewriteCond %{HTTP_HOST} www.example.com
RewriteRule ^.*$ https://www.example.com%{REQUEST_URI} [L,R=301]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.