How to redirect HTTP to HTTPS using htaccess?

Do you want to redirect your website from HTTP to HTTPS? Don’t worry! Today, you will learn how you can easily redirect HTTP to HTTPS using htaccess file.

Are you ready to do it now?

If yes then you just need follow this guide step by step in order to redirect your website from HTTP to HTTPS.

Let’s start.

Steps to redirect HTTP to HTTPS using htaccess file :

Here are the steps you need to follow one by one so that you can also able to redirect HTTP to HTTPS.

STEP 1 – Login To Your cPanel Account

  • Go to NinzaHost.
  • Login your Account.
  • Select your Active Product/Services.
  • Click on “Login to cPanel” under Action Tab.

Login to cPanel

  • Then you will automatically redirected to your cPanel Account.

Or, If you have cPanel login details then you can easily login to your cPanel account by visiting

STEP 2 – Go To File Manager

  • Search “File Manager” in the search bar.
  • Or, Look at the first one that is it.
  • Click on the File Manager.

Click on File Manager

  • Wait for the next page.
  • Now, Click on “public_html” folder.

Go to public_html

STEP 3 – Edit Your .htaccess File

  • If you don’t find .htaccess files then follow this to unhide it –
    • Go to Settings present at the top right corner.
    • Go to Settings
    • You will get a popup soon.
    • Here, you need to tick “Show Hidden Files (dotfiles)” option.
    • Then, click on the “Save” button.
    • Show hidden files
    • Done! You will able to see .htaccess file.
  • Now, right click on .htaccess file.
  • Then, click on Edit button.

Edit .htaccess file

    • If you get a popup then again click on the “Edit” button.
    • Click on Edit button
    • You will now redirected to a next page.
  • Copy the following code mentioned below :
  • RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
  • Paste the code at the top of .htaccess file.
  • Then, click on “Save Changes” at upper right corner.

Click on Save Changes

  • You will now get a success message at lower right corner like this :


  • Done!
  • Now, you can click on “Close” button at upper right or can simply close the tab.
  • At last, check that the redirection is working fine.
  • All set, you are good to go.

Thanks for reading this article. Hope, your doubt regarding how to redirect HTTP to HTTPS using htaccess file is now completely resolved.

If you still have any doubt then please let us know through the comments.

, ,

Related posts

Latest posts

Leave a Comment

Leave a Reply

Your email address will not be published.