How to redirect HTTP to HTTPS

https://www

This is a guide, that will show You an easy way to redirect all non-https request to https.

Why would you do this?

Depends on what kind of site you are hosting. For example, if you are running a billing site, and you want to ensure that all traffic is secure.

To force forwarding, there are two easy ways to do this.

1) Edit/Create a .htaccess file in the folder your site is being served from (normally public_html).

2) Add the following code to the .htaccess file.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

3) Save the file and check the results in your web browser by trying to access your site using standard http rather than https. If it is working correctly, you should be automatically redirected to https.

Note 1: If there is .htaccess file in directories that are child of Web Root, the last .htaccess file will be executed

Note 2: If You do not have an SSL certificate set up for your site, this will cause errors. Please make sure that you have an SSL certificate installed and properly working before forcing redirection (rewrite).

Get the best web hosting plan for you. Now with free SSL certificates and CloudFlare CDN.

Get Started!
icon knowledge

Related Articles

Reset login password

In case You forgot your password, when You try to login, a "Forgot Password?" button will appear...

Change PHP version +(video)

If You have legacy scripts, or just something in your PHP apps doesn't work properly, You can...

Adding existing WordPress Installations in WordPress Toolkit

Hello, In this article, we'll show you how to add your existing WordPress installations to...

How To: Installing Drupal in cPanel using the Softaculous Apps installer

Hey there, are you trying to navigate your way around Drupal? That powerful, open-source content...