How to Redirect HTTP to HTTPS

Hosting & cPanel · 10.02.2025
How to Redirect HTTP to HTTPS

HTTP to HTTPS Redirect via .htaccess

Make sure your SSL certificate is installed before setting up the redirect.

Universal Redirect

Open .htaccess in your site root and add:

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

Redirect from www to non-www

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
← Back to Knowledge Base Ask Support