How to automatically redirect HTTP traffic to HTTPS

Once you have purchased and installed an SSL certificate, you can configure your server to automatically redirect visitors to the secure version of your website. This ensures data sent to and from your website is securely encrypted.

Adopting SSL is becoming increasingly important for website owners. It proves the authenticity of a website and can help boost ranking position in search engine results. Google, in particular, is promoting the use of SSL certificates. Their Chrome browser provides warnings to users accessing unencrypted websites and the company has confirmed that they have adopted the use of HTTPS as a ranking signal.

To redirect HTTP traffic to HTTPS, you will have to create and configure a .htaccess file, which includes the necessary code for automatic redirection. You can easily create (or edit) this file using the cPanel File Manager included with your HostPapa Dashboard. Alternatively, you can create the file using a text editor application on your computer and upload it to your server.

Create or edit the .htaccess file using cPanel’s File Manager

Log in to the HostPapa Dashboard with your Client ID and Password.


Using the top menu, navigate to My cPanel.

HostPapa Dashboard

In the cPanel Dashboard, select the File Manager icon, which will be found in the Files section.


In the File Manager window that opens, click the Settings button at the top right of the page.


In the Preferences panel that opens, ensure Show Hidden Files (dotfiles) is checked and click Save.


Now use the folder tree in the left sidebar to navigate to the root of your website. Check to see if a file named .htaccess already exists. It can be created by default when you install popular CMS packages like WordPress, Drupal or other web apps.


If you do not see a .htaccess file, at the top of the page, click + File. In the panel that opens, under New File Name, enter .htaccess and click Create New File.


Otherwise, highlight the .htaccess file with a left-click and, at the top of the page, select Edit. If you’re asked to confirm encoding, click Edit once again.


The cPanel text editor will now open. If you are creating a new .htaccess file, you’ll see a blank page. However, existing files may already include a set of rules, as shown below.


Enter the following code in your .htaccess file:

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


If you’re editing an existing .htaccess file, check whether the RewriteEngine On rule already exists. If so, do not duplicate it. Ensure the RewriteCond and RewriteRule commands immediately follow the existing RewriteEngine On command, as shown above.

Click Save Changes to complete the redirection.

If you notice any problems or if you need any help, please open a new support ticket from your HostPapa Dashboard. More details on how to open a support ticket can be found here.

Related Articles

Get online with our affordable web hosting

Get online with our affordable web hosting

Learn more now
HostPapa Mustache