我有一个使用wordpress的网站。它最初是在没有SSL的情况下上传和使用的。在安装了服务器证书并为ssl站点添加了apache虚拟主机文件之后,我尝试加载https版本。它装载了许多关于不安全内容正在被裁剪的警告。由于不安全的http协议,许多与wordpress主题相关的css和javascript文件没有被加载,因此产生的网页看起来很难看。
我将.htaccess更改为:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://drjoel.info/$1 [R,L]
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]然后,我按照代码索引说明,将mysql数据库中的"Home“和"Site URL”更改为http中的https。当我再次尝试加载时,浏览器一直显示“太多重定向”错误。我在wget中使用详细和调试选项进行了检查。我得到的是:
---request begin---
GET / HTTP/1.1
User-Agent: Wget/1.19.1 (linux-gnu)
Accept: */*
Accept-Encoding: identity
Host: drjoel.info
Connection: Keep-Alive
Cookie: __cfduid=d700f224676946c9ea07ab3eb7cf5cb861527424630
---request end---
HTTP request sent, awaiting response...
---response begin---
HTTP/1.1 302 Found
Date: Sun, 27 May 2018 12:37:11 GMT
Content-Type: text/html; charset=iso-8859-1
Transfer-Encoding: chunked
Connection: keep-alive
Location: https://drjoel.info/
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 42188807c86caaaa-SIN
---response end---
302 Found
URI content encoding = ‘iso-8859-1’
Location: https://drjoel.info/ [following]
Skipping 204 bytes of body: [
302 Found
Found
The document has moved here.
] done.
URI content encoding = None
Converted file name 'index.html' (UTF-8) -> 'index.html' (UTF-8)
--2018-05-27 18:07:11-- https://drjoel.info/
Reusing existing connection to drjoel.info:443.
Reusing fd 3.这种情况在wget中止之前重复了大约20次。出什么问题了?对Wordpress上的站点启用SSL的正确技术是什么?
发布于 2018-05-27 13:14:06
发布于 2018-05-29 07:06:32
我同意@Mike,避免http重定向,并替换文件和DB中的字符串。替换字符串(甚至序列化)的另一个有用工具-no命令行--是这样一个:https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
https://wordpress.stackexchange.com/questions/304568
复制相似问题