I have a website which uses wordpress. It was initially uploaded and used without SSL. After installing a server certificate and adding the apache virtualhost file for the ssl site, I tried loading the https version. It loaded with a lot of warnings about insecure content being trimmed. The resulting webpage was looking ugly because a lot of css and javascript files related to the wordpress theme were not being loaded because of insecure http protocol.
I changed the .htaccess to the following:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://drjoel.info/$1 [R,L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
I then followed the codex instructions and changed the "Home" and "Site URL" in the mysql database to https from http. When I tried loading again, the browser kept showing "Too many redirects" error. I checked using verbosity and debug option in wget. This is what I get:
---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: [<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://drjoel.info/">here</a>.</p>
</body></html>
] 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.
This is being repeated about 20 times before wget aborts. What's going wrong? What is the correct technique to enable SSL for a site on Wordpress?