Redirect your http site to https

To redirect your http site to https, you can input the following code into your .htaccess file under public_html. Make sure to upload the file into the correct directory.

Redirect your http site to https:

RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don’t put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

 

 

NOTE: We do not recommend editing your .htaccess files without professional assistance. A single wrong line in the .htaccess files may affect your whole website.

To install SSL certificate for your website, you may refer to our article about Secure website with SSL.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to replace the Under Construction page of my website?

By default, our system automatically creates a placeholder Under Construction page for you at...

How to access my hosting control panel?

To access your hosting control panel for managing your Website and email, please use the link:...

How to set up cron job in cPanel?

Cron job is a time-based scheduler that allows you to automate certain commands or scripts on...

Differences Between Shared vs VPS vs Dedicated Hosting

Shared vs VPS vs Dedicated Hosting There are three main types of hosting plans available for...

How to set up cPanel app on Android

The cPanel app is now available on mobile devices which can be used for cPanel, WHM, and Webmail...

Powered by WHMCompleteSolution