简体   繁体   English

www.example.com没有重定向到HTTPS

[英]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站点),

Issue 1: 问题1:

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

Issue 2: 问题2:

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显示旧内容,我们在隐身模式下检查并清除了缓存

Issue 3: (this may be the root cause of the issues) 问题3 :(这可能是问题的根本原因)

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

Environment: 环境:

  1. Godaddy VPS Server Godaddy VPS服务器
  2. Apache 2.3.1 ( mod_rewrite enabled) Apache 2.3.1(启用了mod_rewrite
  3. PHP 5.4.45 PHP 5.4.45
  4. Wordpress WordPress的
  5. Valid SSL Certificate Configured - Required Ports are opened (80, 443) 已配置有效的SSL证书-必需的端口已打开(80、443)

In Wordpress Settings, 在Wordpress设置中,

we placed https address for both Site url and Home page url as https://example.com 我们将Site urlHome page url https地址都设置为https://example.com

we used the below code in .htaccess for redirection 我们使用.htaccess的以下代码进行重定向

RewriteCond %{HTTPS} !on [OR]
RewriteCond %{HTTP_HOST} ^www\.example.com$
RewriteRule ^(.*)$ https://example.com%{REQUEST_URI} [L,R=301]

And we also checked in below sites and they are showing positive response for SSL 而且我们还检查了以下网站,它们对SSL表示肯定的答复

https://www.sslshopper.com , whynopadlock.com https://www.sslshopper.com : whynopadlock.com

Everytime We checked by clearing cache and cookies 每次我们通过清除缓存和cookie进行检查

DNS Records: DNS记录:

A (Host) 一个举办方)

  1. Host @ Points To xx.xx.xx.xx with TTL 600 Seconds 主机@以TTL 600 Seconds xx.xx.xx.xx

CName (Alias) CName(别名)

  1. Host 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.

相关问题 未知 URL 重定向到主页(从 www.example.com/page/2345343 到 www.example.com) - Unknown URLs are redirecting to homepage (from www.example.com/page/2345343 to www.example.com) 将https://example.com/重定向到https://www.example.com/而不更改httpd.conf - Redirect https://example.com/ to https://www.example.com/ without changing httpd.conf WordPress mod_rewrite规则。 停止从example.com重定向到www.example.com - Wordpress mod_rewrite rule. Stop redirecting from example.com to www.example.com 解析 http://www.example.com 以通过 htaccess 永久重定向到 https://example.com - Resolving http://www.example.com to permanently redirect to https://example.com via htaccess 如何在 WordPress 网站中从 www.example.com/2020/70 到 www.example.com 中删除 URL? - How to Remove URL from www.example.com/2020/70 to www.example.com in a WordPress website? 如何在wordpress中将example.com更改为www.example.com - how to change example.com to www.example.com in wordpress Fishpig Wordpress Magento-http://example.com/blog解析为www.example.com,而不是www.example.com/blog - Fishpig Wordpress Magento - http://example.com/blog resolves to www.example.com rather than www.example.com/blog 在其自己的目录(www.example.com/blog)中安装Wordpress - Installing Wordpress in its own directory (www.example.com/blog) 如何将诸如 www.example.com/m/a1 之类的 wordpress 类别 url 修改为 www.example.com/category/m/a1 - how to modified wordpress category url like www.example.com/m/a1 to www.example.com/category/m/a1 将htaccess中的GET变量www.example.com?s=bla+bla替换为www.example.com?search=bla+bla - Replace GET Variable in htaccess www.example.com?s=bla+bla to www.example.com?search=bla+bla
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM