Wednesday, January 29, 2020

How To Redirect HTTP to HTTPS With Hostgator

For security purposes, all websites should use https rather than http. Normally, this can be done by editing the .htaccess file, which is located in the root directory of your website.
The following should be added to the .htaccess file to redirect to https:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]

Just replace www.example.com with your website domain.


Unfortunately, this wasn't working with HostGator. What did work, was making redirect changes within the HostGator account control panel.
This can be done by:

1. Log into your HostGator account control panel
2. Click on Domains in the left hand column
3. Click on Redirects in the Domains section
4. a. Under Add Redirect, Type, select Permanent (301)
b. Select the domain name from the list that you would like to redirect to https://. Optionally, also enter a subdirectory path
c. Under Redirects To, enter the https://domainnametodirectto.com
d. Select Redirect with or without www.
5. Click the Add button

Try it out by going to the https:// version of your domain name.



(paid links)
Computer & Technology Books