Skip to main content

Your privacy

We store what the site needs to work, like a notice you closed or your domain shortlist. With your OK we also use Google Analytics to see which pages help people, and the Meta Pixel to measure which of our adverts work. Privacy policy

Serverlys
Security

Install an SSL certificate and switch WordPress to HTTPS

Get a valid certificate on the domain first, then move WordPress over to https without locking yourself out.

All Security tutorials7 stepsAbout 15 minutes

Before you start

  • The domain already resolving to your hosting server
  • A backup of the WordPress database
  • Control panel access, and ideally SSH with WP-CLI
  1. Step 1: Issue a free certificate

    On cPanel, open Security → SSL/TLS Status, select the domain and its www name, and run AutoSSL. Validation works by reaching the domain, so it only succeeds once DNS points at this server. A name that does not resolve here, such as www without a DNS record, is left off the certificate.

  2. Step 2: Or install a certificate you bought

    Generate the private key and certificate signing request (CSR) in the same panel, under SSL/TLS, and give the CSR to the certificate authority. When the certificate arrives, open Manage SSL sites and paste the certificate; the panel matches it to the stored key. Include the CA bundle the authority supplies, or some browsers and API clients will report the chain as untrusted.

  3. Step 3: Check the certificate before touching WordPress

    Load https://yourdomain.com and https://www.yourdomain.com. Both must open without a warning. Changing WordPress first, while the certificate is invalid, leaves you with an admin area you cannot reach without clicking through errors.

  4. Step 4: Change both WordPress addresses

    Settings → General: WordPress Address (URL) and Site Address (URL) both become https://. If the fields are greyed out, they are set in wp-config.php as WP_HOME and WP_SITEURL — change them there.

  5. Step 5: Rewrite old http links in the content

    Posts and settings still contain http:// URLs. Use WP-CLI's search-replace, which handles WordPress's serialised data correctly. Run it with --dry-run first to see how many replacements it will make.

    wp search-replace 'http://yourdomain.com' 'https://yourdomain.com' --skip-columns=guid --dry-run
    wp search-replace 'http://yourdomain.com' 'https://yourdomain.com' --skip-columns=guid
  6. Step 6: If a proxy or CDN terminates HTTPS

    WordPress may not see the request as secure and keep redirecting to https forever. Tell it to trust the forwarded protocol by adding this to wp-config.php, above the line that says to stop editing. Only do this when a proxy you control sits in front of the site.

    if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) {
        $_SERVER['HTTPS'] = 'on';
    }
  7. Step 7: Redirect http to https

    Finish with a server-level 301 redirect and a mixed-content check, as described in the Force HTTPS tutorial.

The mistake people make

Switching the WordPress addresses to https before the certificate is valid. Every admin page then sits behind a browser warning, and some setups end in a redirect loop that can only be undone in wp-config.php or the database.

Stuck on something not covered here?

Support is included on every plan, and it reaches a person. There is also the blog for the why behind these, and the FAQ for questions about buying.

Get help

A plan that still makes sense in year two

Free migration, free SSL and daily backups on every plan, with a 30-day money-back guarantee.

Prefer the phone? (305) 671-1272 · Existing customer? Client login