Redirect Website to https from .htaccess

  1. Login into your cPanel through the client portal.
  2. Go to you’re the File Manager.
  3. Find your domains folder or if it is the accounts main TLD then you will access the public_html folder.
  4. Once you have access to the domains base folder, click on the “Settings” button at the top right of your browsers screen. You should see a search bar next to it and the button that says “Go”.
  5. A window will pop up that says “Preferences” at the top with various options to choose. For this set of instructions, we are concerned with the option that says “Show Hidden Files (dotfiles).

Note: This will reveal all the files that are necessary to make your site run which are typically hidden. Deleting these files can cause your site to stop working, so proceed carefully.

  1. After selecting the “Show Hidden Files” option, click save.
  2. You can now access your .htaccess file for the domain’s website.

Note: Site file system infrastructures vary and the top most .htaccess file will affect all others first.

  1. Inputting the following code To redirect all traffic to your site’s https version instead of the http non-secured website.
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

If you would like to redirect based on port number instead, you can use the following example.

RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
  1. After you input the code into your .htaccess file, press save.
  2. You can now direct your browser to your website and should see the site redirecting to https versus http.

Note: In the event you do not see the green lock icon on your browser’s URL, it is because there is an image or script still loading over http. Once you have found the script or images and direct them to load over https you will then get the secure icon.

Share this post

Share on facebook
Share on twitter

Business Address

10221 Buena Vista Ave
Suite A
Santee, CA 92071

Customer Service Hours

Monday – Friday: 9:00AM – 5:00PM
Saturday & Sunday: 11:00AM – 3:00PM

Eastern Standard Time

Cherry Host Portal

Return to Customer Portal