Redirecting HTTP to HTTPS Using .htaccess File – Step by Step

Chrome and Firefox have begun displaying warnings on websites with no SSL certificates. Without SSL, your site will probably reveal insecure to the traffic. For that reason, employing an SSL-encrypted connection for safety, availability or PCI compliance reasons is needed. It gets quite essential to redirect from HTTP to HTTPS.

As a way to induce your internet traffic to make use of HTTPS, edit the codes from the .htaccess file. Before we proceed onto redirecting HTTP to HTTPS, here you’re able to edit .htaccess file. In the event that you know to jump to re-direction steps.

Editing .htaccess File

You will find instructions/directives from the .htaccess document that tell the host how to do something in some specific scenarios and directly affects how a website works. Frequent directives from .htaccess document:

  • Re-Directs
  • Rewriting URLs

Ways to edit a .htaccess file:

  • Click on the document onto your own personal pc and upload it into the server with FTP.
  • Utilize”Edit” mode in FTP app which lets you edit a document.
  • Work with a text editor along with SSH to edit the document.
  • Utilize the File Manager in cPanel to edit the document.

Editing .htaccess from cPanel Filemanager

Notice: Backup your internet site if something goes wrong.

  1. Log in to cPanel
  2. File > File Manager > Document Root :
  3. Currently, choose the domain you would like to edit
  4. Assess “Show Hidden Files (dotfiles)”
  5. Click “Go”
  6. Following a brand new window or tab opens, then start looking for that .htaccess file.
  7. Right Click the .htaccess record and click “Code Edit” on the menu.
  8. A dialog box could appear asking about communicating. Click the “Edit” button.
  9. Edit the file
  10. “Save Changes” when done.
  11. Evaluation your site to be certain that it’s done properly. In the event, there’s a mistake, restore into the former version and try again.
  12. As soon as you’re finished, click “Close” to close the window again.

Redirecting HTTP to HTTPS

1. Re-direct All Traffic
For those who have existing code on your .htaccess, include another:

2. Re-Direct Merely a Certain Domain
For Re-directing a specific domain name to use HTTPS, insert the following:

3. Re-Direct Merely a Particular Folder
Redirecting into HTTPS to a specific folder, then include another:

Note: Alter “yourdomain” with your real domain wherever demanded. In addition, in the event of the folder, then replace /folder with all your folder name accordingly.

Think that it had been of use? Share this Guide to assist them Seriously HTTPS 2019