Don't repeat other people's mistakes

Without proper redirection, many sites lost traffic and positions
The easiest route is through your host

Ask hosting support to configure the redirect first

On ordinary hosting this setting is often included in the plan. You avoid editing server files yourself and risking the availability of the site.

  • HTTPS must already open without a warning;
  • the redirect should be permanent — 301 or 308;
  • the page path and query string must be preserved.
Safe sequence for configuration: backup, redirect rule and HTTPS verification
The safe order: save the configuration, enable the redirect, then verify it.

Ready-to-send message for hosting support

Copy the message, replace the domain and state whether the primary version uses WWW.

Hello,
A working SSL certificate is already installed for example.com.
Please configure a permanent 301 or 308 redirect from every HTTP URL
to its corresponding HTTPS URL, preserving the path and query string.
The primary hostname is example.com without www.
Please tell me what was changed when the work is complete.

Before changing it yourself

  1. Open HTTPS and confirm that the browser shows no certificate warning.
  2. Back up the current configuration.
  3. Identify Apache, Nginx, LiteSpeed or the website builder's own panel.
  4. Add only one verified version of the rule.

Technical notes

These examples are for the server owner or the person responsible for configuration. State the primary hostname explicitly.

Apache and .htaccess

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://example.com%{REQUEST_URI} [R=301,L]

Behind a proxy or CDN the condition may differ; follow the provider's documentation.

Nginx

server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;
    return 301 https://example.com$request_uri;
}

Run sudo nginx -t before reloading Nginx.

After the change

  • Test the home page and several internal pages.
  • Confirm that the HTTP version of robots.txt redirects too.
  • Make sure there is no second hop between WWW and non-WWW.
  • Separately check mixed content, internal HTTP links, canonical tags, sitemap.xml and index.php/index.html duplicates.

The final group is not repaired by the HTTP → HTTPS rule and should be handled as separate work when present.