Redirect HTTP to HTTPS (and avoid redirect chains)
Send every visitor to the secure version of your site with one clean 301 redirect.

On this page
Having a certificate isn't enough: visitors who type http:// or click old links must be sent to https://. Search engines also prefer one secure address.
In cPanel (easiest)
- Open Domains → Domains.
- Switch on Force HTTPS Redirect for your domain.
- Test by visiting
http://yourdomain.co.ke— the address bar should change to https.
With .htaccess (Apache and LiteSpeed)
Add this at the top of the .htaccess file in public_html. It also sends www to the bare domain in the same hop:
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://example.co.ke%{REQUEST_URI} [L,R=301]Swap the target if you prefer www.example.co.ke as the main address.
On Nginx
server {
listen 80;
server_name example.co.ke www.example.co.ke;
return 301 https://example.co.ke$request_uri;
}WordPress
Under Settings → General, make sure both WordPress Address and Site Address start with https://. Then run a search-and-replace for old http:// links (see fixing mixed content).
Avoid redirect chains
A chain such as http://www → https://www → https:// → https:///home costs a round trip for every step and slows the first visit. Redirect straight to the final address in one 301, and update menu links, adverts and social profiles to the final URL.
Was this article helpful?
Your vote helps us write better guides.
