NetPoa

Send every visitor to https:// and one address (www or not)

Updated 27 Nov 2026

Your website can be opened four ways: http://yourdomain.co.tz, http://www.yourdomain.co.tz, and the same two with https://. Visitors and Google should always land on one address. That keeps the padlock on, avoids duplicate pages in Google and stops login problems.

First choose which address you prefer: with www (https://www.yourdomain.co.tz) or without (https://yourdomain.co.tz). Both are fine. Just pick one and use it everywhere.

Your SSL certificate must already cover both versions. See Turn on free SSL (HTTPS) for your website.

Option 1: Force HTTPS in cPanel (no code)

  1. Open Services, choose your hosting and press Login to cPanel.
  2. Under Domains, open Domains.
  3. Turn on Force HTTPS Redirect next to your domain.

Now every http:// visit goes to https://. This doesn't choose between www and non-www. For that, use Option 2.

Option 2: Do both with .htaccess

This one block sends everything to a single secure address.

  1. In cPanel, open Files › File Manager.
  2. Press Settings, tick Show Hidden Files (dotfiles) and press Save.
  3. Open public_html, right-click .htaccess and choose Edit. If there is no .htaccess, press + File and create one with that name.
  4. Add the block for your choice at the very top of the file, above any # BEGIN WordPress lines.

Without www (https://yourdomain.co.tz):

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://yourdomain.co.tz%{REQUEST_URI} [L,R=301]

With www (https://www.yourdomain.co.tz):

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.yourdomain.co.tz%{REQUEST_URI} [L,R=301]
  1. Replace yourdomain.co.tz with your domain and press Save Changes.

Download a copy of .htaccess before you edit it. If the site shows an error afterwards, put the old copy back. A typing mistake here can cause a 500 Internal Server Error.

If you used Option 2, you can leave Force HTTPS Redirect on as well. They work together.

WordPress: match the address

  1. In WordPress, go to Settings › General.
  2. Set WordPress Address and Site Address to exactly the address you chose, for example https://yourdomain.co.tz.
  3. Press Save Changes.

If WordPress uses one address and .htaccess sends visitors to the other, the browser shows "Too many redirects". Make them match.

Check it works

Open each of these in a private browser window. All four should end on your chosen address:

  • http://yourdomain.co.tz
  • http://www.yourdomain.co.tz
  • https://yourdomain.co.tz
  • https://www.yourdomain.co.tz

A 301 redirect is permanent, so browsers remember it. If you change your mind later, clear your browser cache before testing again.

Other domains and subdomains

The .htaccess file in public_html only covers your main domain. An addon domain or subdomain has its own folder and needs its own .htaccess with its own name in the rule.


Stuck? Open a ticket and choose Technical. Our team can do it for you. Not hosting with us yet? See our cPanel hosting plans.

Was this helpful?