How to redirect HTTP to HTTPs via .htaccess file

Question: How to redirect website from HTTP to HTTPs?

Answer: To permanently redirect website from HTTP to HTTPs you need to create .htaccess file in website's folder with the following content:

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

  • 12 Users Found This Useful
Was this answer helpful?

Related Articles

How to check site's CPU/Memory usage in cPanel?

cPanel Resource Usage statistics tool comes with all our shared hosting plans. Using this tool...

How to access cPanel hosting account via SSH?

All hosting accounts at WebHostingZone are coming with SSH access enabled. To access your cPanel...

.htaccess redirect all domains to main domain

Question: how to redirect all domains except one to a main domainAnswer: to redirect all domains...

How to switch between different PHP versions in cPanel?

You can easily switch between different PHP versions in your cPanel hosting account. Currently...

How can I log into my cPanel account?

cPanel is a hosting control panel which comes with every hosting account at WebHostingZone. Using...