General
Quickpost: How to add SSL/TLS to WordPress via Cloudflare ☁️ for free
On 08, Juni 2018 | inGeneral | vonJohannes Hoppe
This is not a nice article as usually. But it should help! :-)
wp-config.php
changeWP_HOME
andWP_SITEURL
tohttps://yourdomain
. This example useshaushoppe-its.de
- Get an account at cloudflare. Add your domain to your account. The free plan is fine. Follow the instructions.
- Cloudflare wants you to change your nameserver. Cloudflare is super-cool, you won't regret this. Cloudflare wants
elsa.ns.cloudflare.com
andken.ns.cloudflare.com
. - Pimp the DNS settings. If you want A records (no “www”), it looks like this.
Take care about the proxy setting (orange cloud). You want this for your website, but you definitely do NOT want to break your database.
- Crypto Settings: Encrypt communication to and from your website using SSL. Choose Full SSL. Your origin supports HTTPS, but the certificate installed does not match your domain or is self-signed. Cloudflare will connect to your origin over HTTPS, but will not validate the certificate. Don't choose Flexible SSL. You will encounter a redirect loop.
- Scroll down. Always use HTTPS. Redirects all requests with scheme “http” to “https”. This applies to all http requests to the zone.
- That should be all. Wordpress will do a redirect from “www” to the main domain anyway. If not, see point 8.
- Optional Page Rule: if the URL matches
www.haushoppe-its.de/*
thenForwarding URL: (Status Code: 301 - Permanent Redirect, Url: https://haushoppe-its.de/$1)
- Enjoy your TLS: https://haushoppe-its.de
Cheers! 🍺