cancel
Showing results for 
Search instead for 
Did you mean: 
Go to solution

HTTP to HTTPS redirect not working

On my website (Linux shared hosting), somethingbetterinc.com, I have updated the hcaccess file as GD says to. But when I go to http, it still is not redirecting me to https. HTTPS on its own works, it's just not redirecting there.

 

To be clear, I want when someone goes to http://somethingbetterinc.com, that they are automatically redirected to https://somethingbetterinc.com

 

Here is the code I created for the file.

 

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?somethingbetterinc\.com
RewriteRule ^(.*)$ https://www.somethingbetterinc.com/$1 [R,L]

 

the file is named hcaccess and it saved right in the public_html folder. Thank you in advance for your help!

4 REPLIES
GoDaddy Pro Journeyperson
GoDaddy Pro Journeyperson

Re: HTTP to HTTPS redirect not working

it s .htaccess and not .hcaccess

Please save it as .htaccess 

If you have another file named .htaccess, you can copy the contents to it. But 

  • Do not duplicate RewriteEngine On.
  • Make sure the lines beginning RewriteCond and RewriteRule immediately follow the already-existing RewriteEngine On

Re: HTTP to HTTPS redirect not working

I'm sorry, I DID have it as htaccess - typo in my question.

 

I'm not sure what you mean by "Do not duplicate RewriteEngine On". And it does look like the lines immediately follow. When I download the htaccess file that I have, it looks just like this:

 

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?somethingbetterinc\.com
RewriteRule ^(.*)$ https://www.somethingbetterinc.com/$1 [R,L]

 

NOTE: The files appears to be "htaccess" not ".htaccess" (no dot). However, when I try to rename it to add the . It says that already exists. So I think I have that right, maybe???

 

cPanel_File_Manager_v3.png

 

 

 

cPanel_X_-_File_Manager.png

 

GoDaddy Pro Journeyperson
GoDaddy Pro Journeyperson
Solution

Re: HTTP to HTTPS redirect not working

the .htaccess file will be hidden by default. Use show hidden files option and then open it with editor and paste 

RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?somethingbetterinc\.com
RewriteRule ^(.*)$ https://www.somethingbetterinc.com/$1 [R,L]

below the "RewriteEngine On", in the .htaccess file. 

 

"Do not duplicate RewriteEngine On" means that you should not add another "RewriteEngine On" condition to the .htaccess file, if it already contains "RewriteEngine On" command. I mean there should be "RewriteEngine On" present once in the .htaccess

 

 

 

Re: HTTP to HTTPS redirect not working

Fixed, thank you!

 

There were two files - htaccess and .htaccess. I never even noticed there were two. I was editing the wrong one. Thanks for the help!