Skip to content

Cookie settings

Choose which kinds of cookies you allow. You can change your choice at any time via Cookie settings at the bottom of every page. Privacy statement

Necessary

Always on

Needed to log in, keep your cart and remember your choices. These are always on.

Which cookies?
  • weboke_sessie, weboke_klant, weboke_remember: your session and staying logged in
  • weboke_basket: your cart
  • wkBtwIncl: showing prices with or without VAT
  • wok_cookies: your cookie choice, 12 months

Measures which ad leads to a visit or order, so we do not pay for ads that do nothing.

Which cookies?
  • Google Ads via Google Tag Manager (_gcl_au, _gcl_aw), up to 90 days
  • OpenAI Ads, ads in ChatGPT
  • wok_aff: which partner referred you to us (affiliate programme), 60 days

4.6

Country and language

Each country has its own site, with prices and VAT for that country.

View

Module 3 · 3.1

https and the certificate

Module 3: Address, https and users · Reading time: 8 minutes

Learning objective: After this lesson you can put a WordPress website fully on https and you know what the WordPress address and the site address do.

Key concepts: TLS, certificate, Let's Encrypt, automatic renewal, WordPress address (siteurl), site address (home), WP_HOME and WP_SITEURL, HSTS, getting locked out

What https does

With https, everything between browser and server is encrypted: passwords, forms, cookies, even ordinary pages. Without https, anyone on the same network (public wifi, a hijacked router) can read along and even change the page. Browsers mark a website without https as "not secure" and some features (such as location or the camera) only work with https.

The encryption is called TLS. To prove that the browser is really talking to example.com and not to a middleman, the server has a certificate: digital proof, signed by an issuer that browsers trust. The certificate states the names it covers and until when.

Free certificates and renewal

Let's Encrypt issues free certificates. Almost every hosting provider requests them automatically and renews them automatically too. A certificate from Let's Encrypt is currently valid for 90 days, and Let's Encrypt has announced it will gradually shorten that validity to 45 days. Renewing by hand is therefore not an option: it must be automatic.

A paid certificate doesn't encrypt better. The difference lies in extra verification of the organisation (and sometimes a guarantee). For most websites, a free certificate is fine.

What to check:

  • The certificate must cover every name a visitor might type: example.com and www.example.com. Also the name that only redirects, because the browser checks the certificate before the redirect happens.
  • Automatic renewal only works if the DNS points to your server. If you've moved the DNS or put a proxy (such as Cloudflare) in front of it, check that renewal still works.
  • A CAA record in the DNS can determine which issuers are allowed to create certificates. If Let's Encrypt isn't listed there, the request fails (DNS course lesson 5.2).

Two addresses in WordPress

Under Settings > General there are two addresses. They seem redundant, but they mean something different:

FieldIn the databaseMeaning
WordPress Address (URL)siteurlWhere WordPress's files are located (wp-admin, wp-includes)
Site Address (URL)homeThe address visitors use

Usually they're the same, for example both https://example.com. They only differ if WordPress is installed in a subfolder but the website needs to appear at the root.

WordPress uses these addresses to build all links: to Pages, stylesheets, images, the admin area. If this is set to http://, WordPress builds pages with http:// links, even if the visitor arrives via https. That causes mixed content (lesson 3.2) and redirects back and forth.

Putting a website on https

If you have an existing website on http, these are the steps:

  1. Request a certificate for both names and check that https://example.com works (you'll see a WordPress page, perhaps still without styling).
  2. Make a backup (lesson 8.1).
  3. Set both addresses under Settings > General to https:// and save. You'll be logged out; log in again via https.
  4. Convert old links in the content from http://example.com to https://example.com. Do this with a tool that understands serialised data, such as wp search-replace or a search-and-replace plugin (lesson 3.2), never with a plain SQL command.
  5. Redirect: have the web server send all requests on http to https with a 301 (lesson 3.2). Many hosting providers have a tickbox for this; otherwise a few lines in .htaccess.
  6. Check with the exercise from this lesson and the one from lesson 3.2.

Locked out: when the address is wrong

If you type a typo in the addresses (htps://, a wrong domain), WordPress sends you to that wrong address after saving. You can no longer reach the admin area. Don't panic, there are two ways out:

Via wp-config.php. Add above the line "stop editing":

define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );

These lines take precedence over the values in the database. The fields in Settings > General then turn grey. Log in, set the correct values in the database, and remove the lines again (or deliberately leave them in place, so nobody can change the addresses by accident through the admin area).

Via phpMyAdmin. Open the table wp_options and adjust the values of siteurl and home.

HSTS: making the browser remember

With the header HSTS (Strict-Transport-Security), the server tells the browser: "only visit here via https for the time being." The browser then converts every http:// to https:// itself, without first making an unsecured request.

Strict-Transport-Security: max-age=31536000; includeSubDomains

HSTS is a good extra step, but with a warning: a browser that has seen HSTS will afterwards refuse to open the website without a valid certificate, not even with "proceed anyway". With includeSubDomains, that applies to every subdomain. If you have a subdomain without a certificate (for example an old internal system), it becomes unreachable after HSTS. So start with a short max-age (for example one day, 86400), check everything, and then extend it.

In practice: what it looks like in a panel

As an example we use DirectAdmin. In cPanel this section is called SSL/TLS Status (AutoSSL), in Plesk SSL/TLS Certificates.

  1. Open SSL Certificates for your domain and choose Free and automatic certificate from Let's Encrypt.
  2. Tick example.com and www.example.com and request the certificate.
  3. In the domain settings, tick the option to always send visitors to https (in DirectAdmin: Force SSL with https redirection). Use only one method of redirecting: two different ones at the same time can cause a loop ("too many redirects").
  4. In WordPress, go to Settings > General and set both addresses to https://.

Summary

  • https encrypts everything between browser and server; the certificate proves who the server is.
  • Free certificates from Let's Encrypt are short-lived and renewed automatically; they must cover every name a visitor types.
  • WordPress Address (siteurl) and Site Address (home) must both be set to https://.
  • If you get locked out because of a wrong address, fix it with WP_HOME and WP_SITEURL in wp-config.php or in phpMyAdmin.
  • HSTS is a good extra step; start with a short validity period.

Quiz

1. Your website works on https, but in Settings > General both addresses are still set to http://. What do you notice?



2. You've accidentally saved a typo in the site address and can no longer access the admin area. What helps?



3. Why must the certificate also cover www.example.com if that name only redirects to example.com?



4. What is the risk of HSTS with a long max-age and includeSubDomains?



Exercise

Exercise A3.1: Is your certificate correct? Enter your website's address. The program makes a TLS connection with the bare name and with www (if it exists) and checks: is the certificate valid and trusted, does it cover both names, is it valid for longer than 14 days, and does the website send an HSTS header? If HSTS is missing, that's shown as orange with an explanation, not as an error.

Exercise A3.1: Is your certificate correct?


What you enter and what we find isn't stored. Your browser remembers your answers and whether you've passed the exercise. If you're signed in, we only save that you got the exercise (almost) right in My courses; you can delete that there too.

Further reading

These articles describe the steps in WebOké's panels; in other panels they work in a similar way.

One moment…

Set up your domains

For each domain, arrange the nameservers, the link to your hosting and who becomes the owner.

Loading your domains…