Redirecting HTTP Domains to HTTPS On Dedicated Server

Once SSL is installed on your dedicated server (as explained here) for the domain name you have selected, you will need to redirect all non-secure http links to secure https connection.

For any website to work over SSL, there are some modifications you will need to make to your .htaccess file, and then it will redirect your visitors to the HTTPS version of your website.

Login to your SANGKRIT.net account and follow the given steps:

  1. Go to your SANGKRIT.net product page.
  2. Under the Server, click Manage for cPanel
  3. In the Account Dashboard, click File Manager.
  4. In the cPanel File Manager, click Settings.
  5. Make sure that Show Hidden Files (dotfiles) is checked, and click Save.
  6. Click on public_html, and open your .htaccess if you already have one. If not, click File+, name the file .htaccess and click Create New File.
  7. Select the .htaccess file, and click Edit.
    • If you just created your .htaccess file, use this code:
      RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{HTTP_HOST} ^(www\.)?coolexample\.com RewriteRule ^(.*)$ https://www.coolexample.com/$1 [R,L]
    • If your .htaccess file already exists, insert the lines that begin with ReWriteCond and RewriteRule directly after the already existing ReWriteEngine On.
    • Click Save Changes and Close. 

That’s it. Visit your website and you’ll be re-directed to the HTTPS version.

If you use WordPress, then follow these steps:

  1. Log into your WordPress Dashboard.
  2. Visit Settings, click General.
  3. Locate the following fields:
    • WordPress Address (URL)
    • Site Address (URL)
  4. In each field, update your URLs from http to https
  5. Scroll down and click Save Changes.
  6. Open your current .htaccess file in the /public_html/ folder with the cPanel file manager for editing. If you don’t already have a .htaccess file, you’ll need to create one.
  7. Insert the following code at the top of your .htaccess file:
  8. Click Save Changes at the top-right corner of the screen.

In some cases you will need to edit your .htaccess file, if you don’t want that then you may also use a WordPress plugin such as Really Simple SSL It saves you from following so many technical steps.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.