Forcing HTTPS means nobody ever stays on the unencrypted version of your site. Whoever types http://example.com, follows an old link or opens a bookmark is sent, in a single permanent redirect, to https://example.com. That protects logins and forms, removes the browser’s “Not secure” label, and consolidates search rankings on one address. Order matters: certificate first, redirect second, clean-up third.
Before you start
- A working SSL certificate for both
example.comandwww.example.com. Open thehttps://address in a private window; if you see the padlock, you’re ready. If not, start with the free SSL certificate guide. - Access to your files through cPanel File Manager, FTP/SFTP or SSH.
- A copy of your current
.htaccessand, for WordPress, a database backup. A typo in.htaccesscan take the site down with a 500 error, so keep the old version at hand. - A decision on your preferred address: with
wwwor without. Pick one and use it everywhere.
Step by step
1. Check the certificate status
In cPanel, open Security » SSL/TLS Status. Every domain and subdomain you use should show a valid certificate. If www or an addon domain is missing, confirm its DNS points to the server, then click Run AutoSSL.
2. Add the redirect to .htaccess
Open Files » File Manager, enable Show Hidden Files (dotfiles) from Settings, and edit public_html/.htaccess. Put these lines at the very top, before any other rules, including the # BEGIN WordPress block:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
The condition matches any request that arrived over plain HTTP, and the rule sends it to the same host and path over HTTPS with a permanent 301. LiteSpeed reads .htaccess the same way Apache does, so the rule works unchanged.
To force a single host at the same time, for example dropping www, combine both into one redirect so visitors don’t bounce twice:
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]
Prefer to keep www? Build the matching rule with the .htaccess redirect generator.
Without editing files: in cPanel go to Domains » Domains and switch on Force HTTPS Redirect for the domain. Use either this toggle or the .htaccess rule, not both.
3. Update the WordPress addresses
In WordPress, open Settings » General and change both WordPress Address (URL) and Site Address (URL) to start with https://. Save; WordPress logs you out and you sign in again over HTTPS.
If both fields are greyed out, they are fixed in wp-config.php. Edit them there instead:
define('WP_HOME', 'https://example.com');
define('WP_SITEURL', 'https://example.com');
4. Fix mixed content
Older posts still contain http:// links to images and files, and each one triggers a mixed content warning that hides the padlock. Replace them in the database with a search-and-replace plugin that understands serialized data, or with WP-CLI over SSH:
wp search-replace 'http://example.com' 'https://example.com' --skip-columns=guid --dry-run
wp search-replace 'http://example.com' 'https://example.com' --skip-columns=guid
The first command only reports how many rows would change; the second applies the change. Then look for hard-coded http:// in theme files, custom CSS and page-builder settings, and purge the cache (in LiteSpeed Cache: Purge All).
5. Test the redirect
curl -sI http://example.com/some-page/ | grep -iE "^(HTTP|location)"
You want exactly one 301 with location: https://example.com/some-page/. Repeat for http://www., https://www. and a deep URL with a query string. Finally open the site in a private window, check the padlock, and look at the browser console (F12) for warnings.
6. Consider HSTS, carefully
HSTS tells browsers to go straight to HTTPS for your domain without trying HTTP first. Add it only after HTTPS has worked without problems for a while, and start with a short lifetime of five minutes:
Header always set Strict-Transport-Security "max-age=300"
Once you’re confident, raise max-age to 31536000 (one year). Two options need extra care:
includeSubDomainsapplies the policy to every subdomain. If one of them has no valid certificate, visitors who received the header can no longer open it.preloadasks for your domain to be built into browsers’ HTTPS-only list. Getting removed takes a long time, so add it only if HTTPS will always work on the domain and all its subdomains.
Troubleshooting
ERR_TOO_MANY_REDIRECTS: two places redirect in opposite directions, or Cloudflare SSL is set to Flexible. Keep one rule and use Full (strict). See the redirect loop fix.- 500 Internal Server Error right after editing: a typo in
.htaccess. Restore your copy and paste the rule again as plain text. - No padlock although the address is https: mixed content; the browser console lists every insecure file.
- Certificate warning on
wwwor a subdomain: the certificate doesn’t cover that name yet. Check its DNS and run AutoSSL again. - Some pages still open over http: a cached copy is being served. Purge LiteSpeed Cache and any CDN, then test with
curl, which ignores the browser cache.
On ArabyHost
A free SSL certificate (AutoSSL / Let’s Encrypt) is issued automatically once your domain points to the server, so step 1 is usually done already. The web server is LiteSpeed, which reads the .htaccess rules above as written. You edit .htaccess and check SSL/TLS Status in cPanel, opened with one click from the Araby Panel, and LiteSpeed Cache is available for WordPress. If a redirect breaks something, the Araby AI assistant in the panel can read your error log and explain the cause, and daily JetBackup backups let you restore an earlier .htaccess or database.
FAQ
Will switching to HTTPS hurt my Google rankings?
Not if every http:// URL redirects with a permanent 301 to the same https:// URL. Google treats it as a site move and carries the signals over; rankings may wobble briefly while pages are recrawled.
Should I force HTTPS with .htaccess or a WordPress plugin?
The .htaccess rule is lighter and runs before WordPress loads, so it also covers images and other files. A plugin is fine if you can't edit files, but don't use both, or you risk a redirect loop.
Do www and non-www both need SSL?
Yes. Visitors and old links may use either form, so the certificate must cover both, and your redirect should send both to the one address you prefer.