Server config

.htaccess and Nginx Redirect Rules for Any Site

If your platform doesn't have a built-in HTTPS toggle, the redirect belongs at the web server level, applied to every request before it reaches the application.

Apache (.htaccess)

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Nginx

server {
    listen 80;
    server_name yourdomain.com www.yourdomain.com;
    return 301 https://$host$request_uri;
}

Use a 301 (permanent), not a 302 — this tells search engines the move is final and passes ranking signals to the new URL. Then double-check every internal link, stylesheet, and script reference is also HTTPS, or the padlock will show as "partially secure" due to mixed content.